Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-05-22 00:36:46 +0000
committerGreg Wilkins2015-05-22 00:36:46 +0000
commit8aeec6803cbb941137cd9e71a3d6460819d52e87 (patch)
tree1dc9df060376b86ff243a399af01378a63765f6d
parent5bde7f34ea4c538d12adc6c19794b089c768101e (diff)
downloadorg.eclipse.jetty.project-8aeec6803cbb941137cd9e71a3d6460819d52e87.tar.gz
org.eclipse.jetty.project-8aeec6803cbb941137cd9e71a3d6460819d52e87.tar.xz
org.eclipse.jetty.project-8aeec6803cbb941137cd9e71a3d6460819d52e87.zip
465053 Prevent gzip buffer overflow on complete
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java
index bc5ce29a0d..a56bed0ca5 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java
@@ -316,8 +316,11 @@ public class GzipHttpOutput extends HttpOutput
BufferUtil.compact(_buffer);
int off=_buffer.arrayOffset()+_buffer.limit();
int len=_buffer.capacity()-_buffer.limit()- (_complete?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 complete=_deflater.finished();
if (complete)
addTrailer();

Back to the top