Fix IndexOutOfBoundsException raised by JZlibEncoder.encode()

- Fixes #1471
This commit is contained in:
Trustin Lee 2013-06-20 15:19:46 +09:00
parent c7038ed8d6
commit 96c5ab62e6

View File

@ -287,6 +287,7 @@ public class JZlibEncoder extends ZlibEncoder {
// Configure output.
int maxOutputLength = (int) Math.ceil(inputLength * 1.001) + 12;
out.ensureWritable(maxOutputLength);
z.avail_out = maxOutputLength;
z.next_out = out.array();
z.next_out_index = out.arrayOffset() + out.writerIndex();