3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Increase readComponent string size limit to 262,143 for 1.13-1.20.2 (#1409)

Dieser Commit ist enthalten in:
KoutaChan 2024-09-01 06:11:54 +09:00 committet von GitHub
Ursprung 6100e675af
Commit 67fb3b70a4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -54,6 +54,7 @@ import java.util.Map;
public class ComponentHolder { public class ComponentHolder {
private static final Logger logger = LogManager.getLogger(ComponentHolder.class); private static final Logger logger = LogManager.getLogger(ComponentHolder.class);
public static final int DEFAULT_MAX_STRING_SIZE = 262143;
private final ProtocolVersion version; private final ProtocolVersion version;
private @MonotonicNonNull Component component; private @MonotonicNonNull Component component;
@ -282,6 +283,8 @@ public class ComponentHolder {
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_3)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_3)) {
return new ComponentHolder(version, return new ComponentHolder(version,
ProtocolUtils.readBinaryTag(buf, version, BinaryTagIO.reader())); ProtocolUtils.readBinaryTag(buf, version, BinaryTagIO.reader()));
} else if (version.noLessThan(ProtocolVersion.MINECRAFT_1_13)) {
return new ComponentHolder(version, ProtocolUtils.readString(buf, DEFAULT_MAX_STRING_SIZE));
} else { } else {
return new ComponentHolder(version, ProtocolUtils.readString(buf)); return new ComponentHolder(version, ProtocolUtils.readString(buf));
} }