aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/zip.cc
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-11 15:17:26 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-11 15:26:16 +0000
commit676f39ae51536d2697627ddc352f4af4782fc893 (patch)
treebb637c912f59239610fa2907e6810332a74ecd42 /third_party/ijar/zip.cc
parent4009d2c4938a768158d7ae2ea848933a96737d25 (diff)
Fix ijar compression
Ijar was compressing with the zlib wrapper, which is incompatible with the ZIP format. Unfortunately, the zlib wrapper is totally undocumented. Fixes #436. -- MOS_MIGRATED_REVID=102846162
Diffstat (limited to 'third_party/ijar/zip.cc')
-rw-r--r--third_party/ijar/zip.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/third_party/ijar/zip.cc b/third_party/ijar/zip.cc
index 51e308de7d..5a3d1a589c 100644
--- a/third_party/ijar/zip.cc
+++ b/third_party/ijar/zip.cc
@@ -887,7 +887,9 @@ size_t TryDeflate(u1 *buf, size_t length) {
stream.next_in = buf;
stream.next_out = outbuf;
- if (deflateInit(&stream, Z_DEFAULT_COMPRESSION) != Z_OK) {
+ // deflateInit2 negative windows size prevent the zlib wrapper to be used.
+ if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
+ -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
// Failure to compress => return the buffer uncompressed
free(outbuf);
return length;