TypeConverter: fix crash on arbitrary out-of-bounds item IDs

I don't know why I didn't consider this fix necessary when the item meta bug was originally discovered.
This commit is contained in:
Dylan K. Taylor 2022-06-06 19:29:44 +01:00
parent 6ecfbd1bde
commit 5fd685e07d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -234,6 +234,9 @@ class TypeConverter{
$compound = null;
}
}
if($id < -0x8000 || $id >= 0x7fff){
throw new TypeConversionException("Item ID must be in range " . -0x8000 . " ... " . 0x7fff . " (received $id)");
}
if($meta < 0 || $meta >= 0x7fff){ //this meta value may have been restored from the NBT
throw new TypeConversionException("Item meta must be in range 0 ... " . 0x7fff . " (received $meta)");
}