fssm_unpack: validate DXBC magic and 24-byte XBCH header, guard empty --carve-index and write OSErrors, and preserve index symlinks/mode #1658
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1658"
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?
Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T07:24:08Z.
Item ID:
FSSM-UNPACK-IO-AND-BOUNDSClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155785517
Summary
tools/fssm_unpack.py): validateb"DXBC"magic inparts()(previously any 32-byte blob with zeroed part count succeeded silently) and require the full 24-byte XBCH header in_inflate_xbch()(catching 20..23-byte truncated headers withstruct.error)._unpack_with_count()betweenunpack()andmain()somain()no longer re-parses DXBC/XDAT twice per container.--carve-index(previously falsy""silently fell back to scanning the directory); fail upfront with exit2whenfssm_index.jsonis a directory; catchOSErrorcleanly (exit2, no traceback) when writing.fssmblobs or publishingfssm_index.json.fssm_index.jsontargets so the symlink is preserved, preserve target file mode viafile_mode.published_mode(), and append a trailing newline.tests/test_fssm_unpack.py): add 4 regression tests covering DXBC magic, 20/23-byte truncated XBCH headers, empty--carve-index, directory/writeOSErrorpaths, and symlink/mode preservation.Verification
python3 -W error -I tests/test_fssm_unpack.py -v: 52 passed, 0 failed (1.022s).python3 -I tests/test_replace_retry.py: 10 tests OK (2 skipped).python3 -I tests/test_shader_stage_manifest.py: 17 tests OK.python3 -I tests/test_fssm_crosscheck.py: 6 tests OK.main: ran=52, failures=5, errors=0.python3 -m compileall -q tools/fssm_unpack.py tests/test_fssm_unpack.py,python3 -I tests/test_text_write_line_endings.py,python3 -I scripts/check_no_game_data.py: all pass.AI-assisted: yes
GPUs tested: none (CPU unit tests with synthetic DXBC/XBCH/FSSM bytes; no game data)
Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T07:24:25Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T08:04:25Z.
Independent verification (native Windows, Python 3.11.9): diff vs merge-base reviewed — DXBC magic check, 24-byte XBCH header guard, shared
_unpack_with_count, empty--carve-indexrejection, index-publish symlink/realpath staging withpublished_mode+replace_retryall present. Tests:test_fssm_unpack.py52 OK (1 skip), neighborstest_replace_retry10,test_shader_stage_manifest17,test_fssm_crosscheck6, line-endings 3 — all pass; compileall,--help,check_no_game_dataclean. AI-assisted verification.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:47:01Z.
Red/green:
pytest tests/test_fssm_unpack.pyfails on main (4 failed, 49 passed, 1 skipped, 14 subtests passed) and passes on head9231063348merged with main (51 passed, 1 skipped, 18 subtests passed).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)