There is more than one copy if libz in the tree. Please fix them all.
Ingo Schwarze <[email protected]> wrote: > Hi, > > Olivier Taibi wrote on Wed, Apr 15, 2020 at 07:52:21PM +0200: > > > I believe there is a bug in gzopen(3) when opening an empty file. It > > can read both gzipped and uncompressed files, and obviously an empty > > file falls in the second category, but in this case the first read gives > > a buffer error (Z_BUF_ERROR in zlib.h) instead of EOF (Z_STREAM_END in > > zlib.h) because the stream is incorrectly identified as gzipped. > > From code inspection, i believe this analysis to be correct. > > > The following diff fixes this issue for me. > > I believe the patch is correct and i'd like to commit it. > > I have tested all code path directly leading from gz_open() > into check_header(). > > However, i'm not quite sure how to test the call of check_header() > from gzread(). Marc, is that the fancy feature you are using > in packages? I'd hate breaking pkg_add(1), and so shortly before > lock even more so. Does anybody know how to test that code path, > and can anybody confirm that it still works as expected? > > Any OKs to commit this? > > Or does anybody think that there might be fallout in ports and it > should be postponed until after unlock? > > Yours, > Ingo > > > > Index: gzio.c > > =================================================================== > > RCS file: /cvs/src/lib/libz/gzio.c,v > > retrieving revision 1.14 > > diff -u -p -u -p -r1.14 gzio.c > > --- gzio.c 20 Jul 2005 15:56:41 -0000 1.14 > > +++ gzio.c 15 Apr 2020 12:54:37 -0000 > > @@ -307,7 +307,7 @@ local void check_header(s) > > s->stream.avail_in += len; > > s->stream.next_in = s->inbuf; > > if (s->stream.avail_in < 2) { > > - s->transparent = s->stream.avail_in; > > + s->transparent = 1; > > return; > > } > > } >
