Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=491616
Wojciech Pilorz wpilorz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |wpilorz@gmail.com
--- Comment #6 from Wojciech Pilorz wpilorz@gmail.com 2009-05-15 08:37:44 EDT --- There was a bug report from Hiroshi Kuno on zlib-devel mailing list at Feb 6, 2009:
Please find it attached below, as well as response form Mark Adler. I would suggest looking at the bug, as it might propagate to zfstream; --------------------------------------- I found a bug in minizip, when i create a zip file on a FD. That lose a write error (i.e. disk full), and return ZIP_OK. Thus, the minizip make a broken zip file without a error.
** Where is bug.
zipCloseFileInZipRaw() in src/contrib/minizip/zip.c
1067 if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK)) 1068 if (zipFlushWriteBuffer(zi)==ZIP_ERRNO) 1069 err = ZIP_ERRNO; /* 1. Here, setting ZIP_ERRNO to "err" */ 1070 1071 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 1072 { 1073 err=deflateEnd(&zi->ci.stream); /* 2. BUG! overwriting defalteEnd()'s return-value(ZIP_OK) to "err" */ 1074 zi->ci.stream_initialised = 0; 1075 } 1076
** How to fix.
I have made a small patch that avoid to overwrite to "err", when "err" has a error code. Would you merge my patch?
ndex: /zlib/branches/BUG-write-error/src/contrib/minizip/zip.c =================================================================== --- /zlib/branches/BUG-write-error/src/contrib/minizip/zip.c (revision 537) +++ /zlib/branches/BUG-write-error/src/contrib/minizip/zip.c (revision 566) @@ -1071,5 +1071,6 @@ if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) { - err=deflateEnd(&zi->ci.stream); + int tmperr=deflateEnd(&zi->ci.stream); + if (err==ZIP_OK) err = tmperr; zi->ci.stream_initialised = 0; }
-------------------------------------------- From: xxx (Mark Adler) Date: Thu, 5 Feb 2009 22:03:34 -0800 Subject: [Zlib-devel] Patch for losing a write error
Hiroshi,
Minizip is a contribution to zlib from Gilles Vollant. He is however on this list, so he may respond.
Mark