Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
Fix Varint21FrameDecoder cached length buf usage
Dieser Commit ist enthalten in:
Ursprung
3ab194e185
Commit
55a16d8581
@ -17,10 +17,10 @@ index 672e296cec289abd3bf797d84e16983ca50907be..aec921477e035095d569eab3335175b9
|
|||||||
return function != null ? function.apply(buf) : null;
|
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
|
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
|
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||||
+++ b/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;
|
import java.util.List;
|
||||||
|
|
||||||
public class Varint21FrameDecoder extends ByteToMessageDecoder {
|
public class Varint21FrameDecoder extends ByteToMessageDecoder {
|
||||||
@ -34,13 +34,14 @@ index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
byteBuf.markReaderIndex();
|
byteBuf.markReaderIndex();
|
||||||
|
- byte[] bs = new byte[3];
|
||||||
+ // Paper start - reuse temporary length buffer
|
+ // Paper start - reuse temporary length buffer
|
||||||
+ byte[] abyte = lenBuf;
|
+ byte[] bs = lenBuf;
|
||||||
+ java.util.Arrays.fill(abyte, (byte) 0);
|
+ java.util.Arrays.fill(bs, (byte) 0);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
byte[] bs = new byte[3];
|
|
||||||
|
|
||||||
for(int i = 0; i < bs.length; ++i) {
|
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
|
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
|
index 049e64c355d5f064009b1107ad15d28c44f999dd..acfa1907bfc9c29d261cfccc00d65bad9ad1a002 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren