Reject oversized NUP members before writing them #1596
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1596
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/nup-guard-decompressed-size"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The NUP extractor checks the size of a compressed member after it has written the decoded bytes. A malformed member can therefore write more than its declared size before extraction rejects it.
Check the cumulative decoded size before passing each chunk to the output. This retains the existing checks for incomplete frames, trailing bytes, and short output.
The regression builds a game-free NUP with a member that declares 8 bytes and expands to 65,536. Before the patch, the actual reader rejected the package after writing all 65,536 bytes. It now rejects the first chunk before writing any of it. The extraction CLI also rejected the fixture and left neither the output nor its temporary member.
Five targeted Windows suites and three Linux suites passed locally. The patch also merges cleanly with the two open long-path PRs (#1497 and #1516).