Fix Varint21FrameDecoder cached length buf usage

This commit is contained in:
Shane Freeder 2022-11-22 17:50:31 +00:00
parent 944be7b031
commit 3c0aa837c1

View File

@ -34,13 +34,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java