Validate index when reading structured data type (#4020)

This commit is contained in:
EnZaXD 2024-07-16 09:59:33 +02:00 committed by GitHub
parent 92dedfb950
commit a45985ed58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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