geforkt von Mirrors/Velocity
Strengthen check in JavaVelocityCompressor
Dieser Commit ist enthalten in:
Ursprung
b19d36e939
Commit
b0736548a9
@ -28,16 +28,16 @@ public class JavaVelocityCompressor implements VelocityCompressor {
|
|||||||
public void inflate(ByteBuf source, ByteBuf destination, int max) throws DataFormatException {
|
public void inflate(ByteBuf source, ByteBuf destination, int max) throws DataFormatException {
|
||||||
ensureNotDisposed();
|
ensureNotDisposed();
|
||||||
|
|
||||||
|
final int available = source.readableBytes();
|
||||||
if (source.hasArray()) {
|
if (source.hasArray()) {
|
||||||
inflater.setInput(source.array(), source.arrayOffset() + source.readerIndex(),
|
inflater.setInput(source.array(), source.arrayOffset() + source.readerIndex(), available);
|
||||||
source.readableBytes());
|
|
||||||
} else {
|
} else {
|
||||||
byte[] inData = new byte[source.readableBytes()];
|
byte[] inData = new byte[available];
|
||||||
source.readBytes(inData);
|
source.readBytes(inData);
|
||||||
inflater.setInput(inData);
|
inflater.setInput(inData);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!inflater.finished()) {
|
while (!inflater.finished() && inflater.getBytesRead() < available) {
|
||||||
ensureMaxSize(destination, max);
|
ensureMaxSize(destination, max);
|
||||||
int read = inflater.inflate(buf);
|
int read = inflater.inflate(buf);
|
||||||
destination.writeBytes(buf, 0, read);
|
destination.writeBytes(buf, 0, read);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren