mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Fix out of range enum casts in deSerialize functions (#14090)
This commit is contained in:
@@ -198,7 +198,11 @@ void ItemDefinition::deSerialize(std::istream &is, u16 protocol_version)
|
||||
if (version < 6)
|
||||
throw SerializationError("unsupported ItemDefinition version");
|
||||
|
||||
type = (enum ItemType)readU8(is);
|
||||
type = static_cast<ItemType>(readU8(is));
|
||||
if (type >= ItemType_END) {
|
||||
type = ITEM_NONE;
|
||||
}
|
||||
|
||||
name = deSerializeString16(is);
|
||||
description = deSerializeString16(is);
|
||||
inventory_image = deSerializeString16(is);
|
||||
|
Reference in New Issue
Block a user