diff options
author | Bryce McKinlay <bryce@albatross.co.nz> | 2000-12-18 01:00:23 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2000-12-18 01:00:23 +0000 |
commit | dbb04e883d918fe83fd95f595bb28d25042f316f (patch) | |
tree | 2c89124ad90aef0b64a24158bf0d3bd96f0d669f /libjava/java/util | |
parent | f2aca1970f34a502c0a4f7e3dd6011caf22ea509 (diff) | |
download | gcc-dbb04e883d918fe83fd95f595bb28d25042f316f.zip gcc-dbb04e883d918fe83fd95f595bb28d25042f316f.tar.gz gcc-dbb04e883d918fe83fd95f595bb28d25042f316f.tar.bz2 |
natInflater.cc (inflate): Treat Z_BUF_ERROR as end-of-stream if avail_in is 0.
* java/util/zip/natInflater.cc (inflate): Treat Z_BUF_ERROR as
end-of-stream if avail_in is 0.
From-SVN: r38338
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/zip/natInflater.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libjava/java/util/zip/natInflater.cc b/libjava/java/util/zip/natInflater.cc index f3d258c..a9768fc 100644 --- a/libjava/java/util/zip/natInflater.cc +++ b/libjava/java/util/zip/natInflater.cc @@ -106,6 +106,16 @@ java::util::zip::Inflater::inflate (jbyteArray buf, jint off, jint len) switch (::inflate (s, Z_SYNC_FLUSH)) { + case Z_BUF_ERROR: + /* Using the no_header option, zlib requires an extra padding byte at the + end of the stream in order to successfully complete decompression (see + zlib/contrib/minizip/unzip.c). We don't do this, so can end up with a + Z_BUF_ERROR at the end of a stream when zlib has completed inflation + and there's no more input. Thats not a problem. */ + if (s->avail_in != 0) + throw new java::lang::InternalError; + // Fall through. + case Z_STREAM_END: is_finished = true; if (s->avail_out == (unsigned int) len) @@ -125,11 +135,6 @@ java::util::zip::Inflater::inflate (jbyteArray buf, jint off, jint len) _Jv_Throw (new java::lang::OutOfMemoryError); break; - case Z_BUF_ERROR: - // FIXME? - _Jv_Throw (new java::lang::InternalError); - break; - case Z_OK: break; } |