Skip to content

Commit 23dc313

Browse files
committed
use-safe (#18930)
(cherry picked from commit f7f0f9f)
1 parent e6995ef commit 23dc313

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/src/main/java/org/apache/druid/client/cache/LZ4Transcoder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import net.jpountz.lz4.LZ4Compressor;
2323
import net.jpountz.lz4.LZ4Factory;
24-
import net.jpountz.lz4.LZ4FastDecompressor;
24+
import net.jpountz.lz4.LZ4SafeDecompressor;
2525
import net.spy.memcached.transcoders.SerializingTranscoder;
2626

2727
import java.nio.ByteBuffer;
@@ -66,12 +66,12 @@ protected byte[] decompress(byte[] in)
6666
{
6767
byte[] out = null;
6868
if (in != null) {
69-
LZ4FastDecompressor decompressor = lz4Factory.fastDecompressor();
69+
LZ4SafeDecompressor decompressor = lz4Factory.safeDecompressor();
7070

7171
int size = ByteBuffer.wrap(in).getInt();
7272

7373
out = new byte[size];
74-
decompressor.decompress(in, Integer.BYTES, out, 0, out.length);
74+
decompressor.decompress(in, Integer.BYTES, in.length - Integer.BYTES, out, 0, out.length);
7575
}
7676
return out == null ? null : out;
7777
}

0 commit comments

Comments
 (0)