diff options
author | Martin Emde <martin.emde@gmail.com> | 2023-12-21 14:11:02 -0800 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-02-22 06:42:06 +0000 |
commit | 9f8f32bf9f3758ba67dd2afe7e07d9eccb68bbc7 (patch) | |
tree | 1e4f0f4b5c5fb70eb523d78e51534eba7be36413 /ext | |
parent | 7acc8bbea5f7f61e5154be8adb391f3dd641186c (diff) |
[ruby/zlib] In Zlib::GzipReader#eof? check if we're actually at eof
Only consider it eof if we read ahead and something fills the buf.
If not, we may only have empty blocks and the footer.
Fixes https://github.com/ruby/zlib/pull/56
https://github.com/ruby/zlib/commit/437bea8003
Diffstat (limited to 'ext')
-rw-r--r-- | ext/zlib/zlib.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index dc608ee460..fe03072576 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -3500,6 +3500,9 @@ static VALUE rb_gzfile_eof_p(VALUE obj) { struct gzfile *gz = get_gzfile(obj); + while (!ZSTREAM_IS_FINISHED(&gz->z) && ZSTREAM_BUF_FILLED(&gz->z) == 0) { + gzfile_read_more(gz, Qnil); + } return GZFILE_IS_FINISHED(gz) ? Qtrue : Qfalse; } |