Skip to content

Validate spell IDs after deserializing item save data#8631

Open
Santaingamba wants to merge 1 commit into
diasurgical:masterfrom
Santaingamba:fix_invalid_spell_validation
Open

Validate spell IDs after deserializing item save data#8631
Santaingamba wants to merge 1 commit into
diasurgical:masterfrom
Santaingamba:fix_invalid_spell_validation

Conversation

@Santaingamba

Copy link
Copy Markdown

Summary

Validate item._iSpell immediately after deserializing it in LoadItemData().

If the loaded spell ID is invalid, it is replaced with SpellID::Null before it can be used by the rest of the codebase.

Motivation

Issue #8547 reports that an invalid spell ID loaded from save data can later be passed to GenerateStaffNameMagical(), resulting in an out-of-bounds access to the spell data table.

Validating the value at the deserialization boundary prevents invalid spell IDs from propagating further.

Closes #8547.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue Report]: Unvalidated spell ID from save data causes incorrect indexing in GenerateStaffNameMagical()

1 participant