+2011-09-07 Version 1.0.2
+ - Fixed a bug in deflate, which caused it to exit prematurely and
+ report valid files as corrupt.
+
2011-05-27 Version 1.0.1
- Removed private classes from doxygen output
- Added the zipper utility executable
cd libzipper-${VERSION}
dpkg-buildpackage -rfakeroot
-if ! lintian --color auto --fail-on-warnings -i ${BUILD}/libzipper_1.0.1-1.dsc; then
+if ! lintian --color auto --fail-on-warnings -i ${BUILD}/libzipper_1.0.2-1.dsc; then
echo "Build failed"
exit 1;
-elif ! lintian --color auto --fail-on-warnings -i ${BUILD}/libzipper_1.0.1-1_amd64.changes; then
+elif ! lintian --color auto --fail-on-warnings -i ${BUILD}/libzipper_1.0.2-1_amd64.changes; then
echo "Build failed"
exit 1;
else
+libzipper (1.0.2-1) unstable; urgency=low
+
+ * Fixed a bug in the deflate methods, which would report corrupt data for
+ valid zip/gzip files.
+
+ -- Michael McMaster <michael@codesrc.com> Wed, 07 Sep 2011 21:59:18 +1000
+
libzipper (1.0.1-1) unstable; urgency=low
* Initial release. (Closes: #628118)
DeflateDeleter deleter(&stream);
stream.next_in = NULL;
stream.avail_in = 0;
+ bool finished(false);
zsize_t pos(0);
zsize_t end(reader.getSize());
crc = crc32(0, NULL, 0);
- while (pos < end)
+ while (!finished)
{
- if (stream.avail_in == 0)
+ if ((stream.avail_in == 0) && (pos < end))
{
stream.avail_in =
std::min(zsize_t(ChunkSize), end - pos);
stream.next_out = reinterpret_cast<Bytef*>(&outChunk);
stream.avail_out = sizeof(outChunk);
+ finished = false;
zlibErr = deflate(&stream, (pos < end) ? Z_NO_FLUSH : Z_FINISH);
if (zlibErr == Z_STREAM_END)
assert(!"zlib buffer unexpectedly empty");
std::terminate();
}
+ finished = true;
}
else if (zlibErr != Z_OK)
{
zsize_t pos(readOffset);
crc = crc32(0, NULL, 0);
- while (pos < readEnd)
+ while (!finished)
{
if (stream.avail_in == 0)
{
stream.avail_in = std::min(zsize_t(ChunkSize), readEnd - pos);
+ if (stream.avail_in == 0)
+ {
+ break;
+ }
reader->readData(pos, stream.avail_in, &inChunk[0]);
stream.next_in = reinterpret_cast<Bytef*>(&inChunk);
pos += stream.avail_in;
writer.writeData(writeOffset, bytesToWrite, &outChunk[0]);
writeOffset += bytesToWrite;
crc = crc32(crc, &outChunk[0], bytesToWrite);
-
- if (finished) break;
}
if (!finished)
{