Fix Varint21FrameDecoder cached length buf usage
This commit is contained in:
parent
3ab194e185
commit
55a16d8581
|
@ -17,10 +17,10 @@ index 672e296cec289abd3bf797d84e16983ca50907be..aec921477e035095d569eab3335175b9
|
|||
return function != null ? function.apply(buf) : null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0ff537550 100644
|
||||
index 99b581052f937b0f2d6b5d73de699008c1d51774..81ec2011a93bb94200ad750f4666ba1cd8be11c5 100644
|
||||
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
+++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
@@ -8,8 +8,20 @@ import io.netty.handler.codec.CorruptedFrameException;
|
||||
@@ -8,9 +8,20 @@ import io.netty.handler.codec.CorruptedFrameException;
|
||||
import java.util.List;
|
||||
|
||||
public class Varint21FrameDecoder extends ByteToMessageDecoder {
|
||||
|
@ -34,13 +34,14 @@ index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0
|
|||
+ }
|
||||
+ // Paper end
|
||||
byteBuf.markReaderIndex();
|
||||
- byte[] bs = new byte[3];
|
||||
+ // Paper start - reuse temporary length buffer
|
||||
+ byte[] abyte = lenBuf;
|
||||
+ java.util.Arrays.fill(abyte, (byte) 0);
|
||||
+ byte[] bs = lenBuf;
|
||||
+ java.util.Arrays.fill(bs, (byte) 0);
|
||||
+ // Paper end
|
||||
byte[] bs = new byte[3];
|
||||
|
||||
for(int i = 0; i < bs.length; ++i) {
|
||||
if (!byteBuf.isReadable()) {
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
index 049e64c355d5f064009b1107ad15d28c44f999dd..acfa1907bfc9c29d261cfccc00d65bad9ad1a002 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
|
|
Loading…
Reference in New Issue