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