ruby/ext/zlib
Sorah Fukumori d2864ca330 [ruby/zlib] Zlib.gunzip should not fail with utf-8 strings
(https://github.com/ruby/zlib/pull/55)

zstream_discard_input was encoding and character-aware when given input is user-provided, so this discards `len` chars instead of `len` bytes.

Also Zlib.gunzip explains in its rdoc that it is equivalent with the following code, but this doesn't fail for UTF-8 String.

```ruby
string = %w[1f8b0800c28000000003cb48cdc9c9070086a6103605000000].pack("H*").force_encoding('UTF-8')
sio = StringIO.new(string)
p gz.read #=> "hello"
gz&.close
p Zlib.gunzip(string) #=> Zlib::DataError
```

Reported and discovered by eagletmt at https://twitter.com/eagletmt/status/1689692467929694209

https://github.com/ruby/zlib/commit/c5e58bc62a
2023-08-10 20:12:21 +00:00
..
.gitignore ignore external library sources [ci skip] 2018-01-26 03:13:33 +00:00
depend Update the depend files 2023-02-28 09:09:00 -08:00
extconf.rb [ruby/zlib] Check for functions with arguments and the header 2023-01-09 10:46:02 +00:00
zlib.c [ruby/zlib] Zlib.gunzip should not fail with utf-8 strings 2023-08-10 20:12:21 +00:00
zlib.gemspec [ruby/zlib] gemspec: Remove unused files 2021-04-20 21:19:41 +09:00