465053 Prevent gzip buffer overflow on complete

This commit is contained in:
Greg Wilkins 2015-05-22 10:46:40 +10:00
parent 8aeec6803c
commit ac7b515915
1 changed files with 5 additions and 3 deletions

View File

@ -388,9 +388,11 @@ public class GzipHttpOutput extends HttpOutput
BufferUtil.compact(_buffer);
int off=_buffer.arrayOffset()+_buffer.limit();
int len=_buffer.capacity()-_buffer.limit() - (_last?8:0);
int produced=_deflater.deflate(_buffer.array(),off,len,Deflater.NO_FLUSH);
_buffer.limit(_buffer.limit()+produced);
if (len>0)
{
int produced=_deflater.deflate(_buffer.array(),off,len,Deflater.NO_FLUSH);
_buffer.limit(_buffer.limit()+produced);
}
boolean finished=_deflater.finished();
if (finished)