summaryrefslogtreecommitdiff
path: root/java/util/zip/Inflater.java
diff options
context:
space:
mode:
authorJochen Hoenicke <jochen@gnu.org>2002-07-05 21:28:07 +0000
committerJochen Hoenicke <jochen@gnu.org>2002-07-05 21:28:07 +0000
commit80c80b17e1c688826c4b9c4bb900f115d2dcf055 (patch)
tree1c9cb34d7d7308de5002008793294368816b184b /java/util/zip/Inflater.java
parent3ebb9ae2e21100bd3a4a66fc667cab94680eb83b (diff)
downloadclasspath-80c80b17e1c688826c4b9c4bb900f115d2dcf055.tar.gz
* java/util/zip/Inflater.java
(inflate): Handle zero length. Fully check for ArrayIndexOutOfBoundsException. * java/util/zip/DeflaterEngine.java (slideWindow): New function, takes out some code from fillWindow. Slide the prev array too, and handle head/prev values as unsigned. (deflateFast): Always slide window when strstart + MIN_LOOKAHEAD falls out of window. This is needed when we are flushing. (deflateSlow): Likewise.
Diffstat (limited to 'java/util/zip/Inflater.java')
-rw-r--r--java/util/zip/Inflater.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/java/util/zip/Inflater.java b/java/util/zip/Inflater.java
index 48f7f7eeb..eedf618b7 100644
--- a/java/util/zip/Inflater.java
+++ b/java/util/zip/Inflater.java
@@ -572,13 +572,16 @@ public class Inflater
* @return the number of bytes written to the buffer, 0 if no further
* output can be produced.
* @exception DataFormatException if deflated stream is invalid.
- * @exception IllegalArgumentException if len is lt;eq; 0.
* @exception IndexOutOfBoundsException if the off and/or len are wrong.
*/
public int inflate(byte[] buf, int off, int len) throws DataFormatException
{
- if (len <= 0)
- throw new IllegalArgumentException("len <= 0");
+ /* Special case: len may be zero */
+ if (len == 0)
+ return 0;
+ /* Check for correct buff, off, len triple */
+ if (0 > off || off > off + len || off + len > buf.length)
+ throw new ArrayIndexOutOfBoundsException();
int count = 0;
int more;
do