Operating System
Linux x86
DevilutionX version
1.5.5
Describe
The item spell ID read from save data is passed directly into GenerateStaffNameMagical()(Source/items.cpp) without any validation. An invalid spell ID can reach the staff-name generation logic and incorrectly index into spell data tables, leading to undefined behavior, a crash, or corrupted item names.
To Reproduce
- Craft or modify a save file so that an item's spell ID field holds an invalid or out-of-range value.
- Load the save file in DevilutionX.
- Allow the game to generate or display the name of a magical staff that references the corrupted spell ID.
- Observe a crash, garbled item name, or incorrect spell data being read.
Expected Behavior
The spell ID loaded from save data should be validated before use. Any value that does not correspond to known, valid spell should be remapped to SpellID::Null so that the staff-name generation logic handles it safely and predictably.
Additional context
- Vulnerable function: GenerateStaffNameMagical() in Source/items.cpp
- The root cause is a missing validation step after deserializing the spell ID from save data.
- Suggested fix: after loading the spell ID, check whether it falls within the valid SpellID enum range; if not, assign SpellID::Null before passing it to any downstream logic.
Operating System
Linux x86
DevilutionX version
1.5.5
Describe
The item spell ID read from save data is passed directly into GenerateStaffNameMagical()(Source/items.cpp) without any validation. An invalid spell ID can reach the staff-name generation logic and incorrectly index into spell data tables, leading to undefined behavior, a crash, or corrupted item names.
To Reproduce
Expected Behavior
The spell ID loaded from save data should be validated before use. Any value that does not correspond to known, valid spell should be remapped to SpellID::Null so that the staff-name generation logic handles it safely and predictably.
Additional context