Validate DS ROM binary ranges without overflow - #2714
Open
acts-1631 wants to merge 1 commit into
Open
Conversation
DS ROM validation added attacker-controlled offsets and lengths before checking the result against the ROM size. Wrapped additions passed the validation and later reached raw ROM loads. Non-word-aligned binary lengths also let the word-at-a-time loader read past the image. Validate each range by subtraction, require word-aligned binary lengths, and require the complete secure area when its special load path applies.
acts-1631
force-pushed
the
fix/ds-rom-range-validation
branch
from
July 29, 2026 18:19
64a256a to
f15cc60
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NDSCart::ValidateROM checked ARM9 and ARM7 binary ranges by adding the
header-provided offset and size before comparing the result with the ROM
length. A wrapped addition could pass that check even though the binary range
was outside the ROM.
NDS::Reset later loads these binaries in 32-bit words, so non-word-aligned
sizes could also make the final load extend beyond an accepted image. The
special ARM9 secure-area path similarly expects a complete 0x800-byte region.
Validate ranges by subtraction after checking the offset, require word-aligned
binary sizes, and reject incomplete secure areas before the load paths run.