From 4d3ed11584d23828cad2d10767b7a52f7826aa67 Mon Sep 17 00:00:00 2001 From: Fankux Date: Tue, 19 Apr 2022 10:46:44 +0800 Subject: [PATCH] fix v2 protocol lz4 decompress (#33) correct length of output bytes of decompress action --- .../clogproxy/client/connection/ClientHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientHandler.java b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientHandler.java index 2972d1d..be10307 100644 --- a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientHandler.java +++ b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientHandler.java @@ -275,9 +275,9 @@ public class ClientHandler extends ChannelInboundHandlerAdapter { int rawLen = recordData.getRawLen(); byte[] rawData = recordData.getRecords().toByteArray(); if (compressType == CompressType.LZ4.code()) { - byte[] bytes = new byte[compressedLen]; - int decompress = fastDecompressor.decompress(rawData, 0, bytes, 0, compressedLen); - if (decompress != rawLen) { + byte[] bytes = new byte[rawLen]; + int decompress = fastDecompressor.decompress(rawData, 0, bytes, 0, rawLen); + if (decompress != compressedLen) { throw new LogProxyClientException( ErrorCode.E_LEN, "decompressed length [" -- GitLab