From 3c0aa837c131936069a13350e1b434a715ff8deb Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 22 Nov 2022 17:50:31 +0000 Subject: [PATCH] Fix Varint21FrameDecoder cached length buf usage --- .../Optimize-NetworkManager-Exception-Handling.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patches/server/Optimize-NetworkManager-Exception-Handling.patch b/patches/server/Optimize-NetworkManager-Exception-Handling.patch index 679725a1bc..6e2d457c78 100644 --- a/patches/server/Optimize-NetworkManager-Exception-Handling.patch +++ b/patches/server/Optimize-NetworkManager-Exception-Handling.patch @@ -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