Repository navigation
Conversation
…eir contracts (GitHub issue seedds#454) The fuzz harnesses (seedds#455) found two readers that raise struct.error on files cut short. nacp.name unpacked the u16 size of a compressed title area before checking that the file holds two bytes, so a 0- or 1-byte control.nacp raised where name() otherwise returns ''. romfs.Image unpacked its 32-byte header from a short read, so an image cut short after its magic raised struct.error instead of its ValueError. - name() tries the compressed title area only when the file holds its size; a shorter file returns '' through the plain title scan. - Image() raises "invalid RomFS image header" when fewer than 32 header bytes come back, as its other header checks do. known.tsv loses the 2 seedds#454 rows; corpus/nacp/empty.bin and corpus/romfs/magic-only.img now replay as regular tests. Checked: test_fuzz_corpus passes (32 tests) and fails with both code changes reverted. The other tool tests have main's results on Linux. The lint ratchet reports 0 new. atheris, 60 s per harness: nacp 571,690 runs, romfs 1,353,160 runs, no finding.
1 of 3 tasks
seedds
added a commit
that referenced
this pull request
Oct 29, 2026
…eir contracts (GitHub issue #454) (#605) The fuzz harnesses (#455) found two readers that raise struct.error on files cut short. nacp.name unpacked the u16 size of a compressed title area before checking that the file holds two bytes, so a 0- or 1-byte control.nacp raised where name() otherwise returns ''. romfs.Image unpacked its 32-byte header from a short read, so an image cut short after its magic raised struct.error instead of its ValueError. - name() tries the compressed title area only when the file holds its size; a shorter file returns '' through the plain title scan. - Image() raises "invalid RomFS image header" when fewer than 32 header bytes come back, as its other header checks do. known.tsv loses the 2 #454 rows; corpus/nacp/empty.bin and corpus/romfs/magic-only.img now replay as regular tests. Checked: test_fuzz_corpus passes (32 tests) and fails with both code changes reverted. The other tool tests have main's results on Linux. The lint ratchet reports 0 new. atheris, 60 s per harness: nacp 571,690 runs, romfs 1,353,160 runs, no finding. Co-authored-by: DongHyun Kim <271588+mrkayhyun@users.noreply.github.com>
Owner
2 tasks
26 of 42 tasks
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…eir contracts (GitHub issue seedds#454) (seedds#605) The fuzz harnesses (seedds#455) found two readers that raise struct.error on files cut short. nacp.name unpacked the u16 size of a compressed title area before checking that the file holds two bytes, so a 0- or 1-byte control.nacp raised where name() otherwise returns ''. romfs.Image unpacked its 32-byte header from a short read, so an image cut short after its magic raised struct.error instead of its ValueError. - name() tries the compressed title area only when the file holds its size; a shorter file returns '' through the plain title scan. - Image() raises "invalid RomFS image header" when fewer than 32 header bytes come back, as its other header checks do. known.tsv loses the 2 seedds#454 rows; corpus/nacp/empty.bin and corpus/romfs/magic-only.img now replay as regular tests. Checked: test_fuzz_corpus passes (32 tests) and fails with both code changes reverted. The other tool tests have main's results on Linux. The lint ratchet reports 0 new. atheris, 60 s per harness: nacp 571,690 runs, romfs 1,353,160 runs, no finding. Co-authored-by: DongHyun Kim <271588+mrkayhyun@users.noreply.github.com>
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.
What and why
Fixes #454. The fuzz harnesses (#455) found two parsers that raise
struct.erroron files cut short, instead of keeping their contracts:nacp.nameunpacked the u16 size of a compressed title area before checking the file holds two bytes, so a 0- or 1-byte control.nacp raisedstruct.errorwherename()otherwise returns''. It now tries the compressed area only when the file holds that size; a shorter file falls through to the plain title scan and returns''.romfs.Imageunpacked the 32-byte header from whateverreadreturned, so an image cut short after its magic raisedstruct.error. It now raises the sameValueError('invalid RomFS image header: …')as the other header checks when fewer than 32 bytes come back.dm/tools/fuzz/known.tsvloses the two #454 rows, socorpus/nacp/empty.binandcorpus/romfs/magic-only.imgreplay as ordinary regression tests intest_fuzz_corpus.pyinstead of expected failures. No reference entry or game note: the change keeps the parsers' documented contracts and adds no mechanism, as with the uepak (#453) and shader_split (#452) fixes.Checked
DM_GAME=010015100B514000): everydm/tools/tests,dm/ios/testsanddm/gfx/testsfile has the same result as on main excepttest_fuzz_corpus.py, which goes fromOK (expected failures=2)toOK(32 tests). The files that fail on Linux fail the same way on main (they need macOS:renamex_np, Xcode, Metal, the .NET translator, spirv-val).test_nacp_empty_binandtest_romfs_magic_only_imgfail withstruct.error@nacp.py:nameandstruct.error@romfs.py:__init__.''/[]; DMROMFS1 images of 0 to 31 bytes raiseValueError.392 findings, 392 in the baseline, 0 new, 0 fixed but still listed.scripts/regress.py check --gamesnot run: it needs local games, and the reach is two readers' handling of files under 32 bytes, which no game's files are.Docs
The finding is in its game note or its docs/reference entry— not applicable: no new mechanism (see above)A chain tool changed— not applicableThis change was prepared with the help of AI coding tools; I reviewed the diff and ran the checks above myself.