SPDY: fix header block values truncation in decompression
This commit is contained in:
parent
5ec179c33c
commit
0cb145ed68
@ -544,8 +544,13 @@ public class SpdyFrameDecoder extends FrameDecoder {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Perhaps last call to decode filled output buffer
|
// Perhaps last call to decode filled output buffer
|
||||||
headerBlockDecompressor.decode(decompressed);
|
int numBytes;
|
||||||
return decompressed.readableBytes() >= bytes;
|
boolean done;
|
||||||
|
do {
|
||||||
|
numBytes = headerBlockDecompressor.decode(decompressed);
|
||||||
|
done = decompressed.readableBytes() >= bytes;
|
||||||
|
} while (!done && numBytes > 0);
|
||||||
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int readLengthField() {
|
private int readLengthField() {
|
||||||
|
@ -24,6 +24,6 @@ abstract class SpdyHeaderBlockDecompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract void setInput(ChannelBuffer compressed);
|
abstract void setInput(ChannelBuffer compressed);
|
||||||
abstract void decode(ChannelBuffer decompressed) throws Exception;
|
abstract int decode(ChannelBuffer decompressed) throws Exception;
|
||||||
abstract void end();
|
abstract void end();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class SpdyHeaderBlockZlibDecompressor extends SpdyHeaderBlockDecompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(ChannelBuffer decompressed) throws Exception {
|
public int decode(ChannelBuffer decompressed) throws Exception {
|
||||||
try {
|
try {
|
||||||
int numBytes = decompressor.inflate(out);
|
int numBytes = decompressor.inflate(out);
|
||||||
if (numBytes == 0 && decompressor.needsDictionary()) {
|
if (numBytes == 0 && decompressor.needsDictionary()) {
|
||||||
@ -56,6 +56,7 @@ class SpdyHeaderBlockZlibDecompressor extends SpdyHeaderBlockDecompressor {
|
|||||||
numBytes = decompressor.inflate(out);
|
numBytes = decompressor.inflate(out);
|
||||||
}
|
}
|
||||||
decompressed.writeBytes(out, 0, numBytes);
|
decompressed.writeBytes(out, 0, numBytes);
|
||||||
|
return numBytes;
|
||||||
} catch (DataFormatException e) {
|
} catch (DataFormatException e) {
|
||||||
throw new SpdyProtocolException(
|
throw new SpdyProtocolException(
|
||||||
"Received invalid header block", e);
|
"Received invalid header block", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user