diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-18 01:00:23 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-18 01:00:23 +0000 |
commit | 192a140f620bc445e1e5c003b4b73aeec8300498 (patch) | |
tree | 2c89124ad90aef0b64a24158bf0d3bd96f0d669f /libjava | |
parent | 16de2a826a3f6e7011d6bf6544b8b55ca288f969 (diff) | |
download | gcc-192a140f620bc445e1e5c003b4b73aeec8300498.tar.gz |
* java/util/zip/natInflater.cc (inflate): Treat Z_BUF_ERROR as
end-of-stream if avail_in is 0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38338 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/util/zip/natInflater.cc | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index b19f7dcb163..1bbb6faec23 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2000-12-18 Bryce McKinlay <bryce@albatross.co.nz> + + * java/util/zip/natInflater.cc (inflate): Treat Z_BUF_ERROR as + end-of-stream if avail_in is 0. + 2000-12-17 Bryce McKinlay <bryce@albatross.co.nz> * java/util/ArrayList.java (data): Declare transient. diff --git a/libjava/java/util/zip/natInflater.cc b/libjava/java/util/zip/natInflater.cc index f3d258cdd59..a9768fce77d 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; } |