3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-28 06:31:05 +02:00

Validate index when reading structured data type (#4020)

Dieser Commit ist enthalten in:
EnZaXD 2024-07-16 09:59:33 +02:00 committet von GitHub
Ursprung 92dedfb950
Commit a45985ed58
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -50,7 +50,7 @@ public class StructuredDataType extends Type<StructuredData<?>> {
public StructuredData<?> read(final ByteBuf buffer) { public StructuredData<?> read(final ByteBuf buffer) {
Preconditions.checkNotNull(types, "StructuredDataType has not been initialized"); Preconditions.checkNotNull(types, "StructuredDataType has not been initialized");
final int id = Types.VAR_INT.readPrimitive(buffer); final int id = Types.VAR_INT.readPrimitive(buffer);
final StructuredDataKey<?> key = this.types[id]; final StructuredDataKey<?> key = key(id);
if (key == null) { if (key == null) {
throw new IllegalArgumentException("No data component serializer found for id " + id); throw new IllegalArgumentException("No data component serializer found for id " + id);
} }