[Zlib-devel] Patch for losing a write error
Hiroshi Kuno
hkuno-zlib at microhouse.co.jp
Fri Feb 6 00:09:05 EST 2009
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?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: changeset_r566.diff
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20090206/7ee81ed5/attachment.ksh>
More information about the Zlib-devel
mailing list