Repository navigation
skin_streams: validate the dictionary first-child pointer - #2836
Conversation
toeeshchaudhary
left a comment
There was a problem hiding this comment.
The pointer is checked before dereferencing a complete eight-byte entry, and the header-only classification is retained when the entry lies beyond the prefix. All 28 skin-stream tests passed on Windows.
|
Independent dictionary prefix boundary sweep ( AI-assisted (Codex). |
kacper-serewis
left a comment
There was a problem hiding this comment.
Independent Windows CPU retail check. Complete skin_streams.py JSON reports matched between ec8ec4c and 93837c2 on the three top-level data.rpf, packs.rpf and levels.rpf archives. Of 46,788 dictionary candidates, 46,464 had a valid in-prefix first child and 324 had the first-child slot beyond the prefix. All retained their classification. An independent prefix walk confirmed every child header in 45,379 dictionaries. The remaining 1,409 were unconfirmed by that stricter check. No invalid in-prefix first child occurred, so rejection remains covered by synthetic tests. Nested archives and other package files were outside the run. #2610 was absent from both revisions. AI-assisted.
Kam471
left a comment
There was a problem hiding this comment.
Verified on the PR head: python -I tests/test_skin_streams.py -> 28 OK; the focused dictionary-child class 4/4. On current main the two negative tests fail (2 failures, 2 pass), so the pointer bound is exercised. The condition matches the pinned rpf9-explorer DrawableDictionaryCheckBytes, including the values > len-8 boundary and sys_ptr(first). Synthetic bytes only; no game data or absolute paths. Approve.
Non-blocking: the pinned decoder also requires sys_ptr(+8) and validates the child header at first + 176; Python still returns "dictionary" for a synthetic header with +8 = 0x12345678, so “last check”/full parity is overstated.
93837c2 to
d721e85
Compare
|
PASS. Python-only, non-draft, merge clean; Coverage note, not a defect: the "array beyond prefix" test ( Approve. AI-assisted review, no game files, no GPU. |
|
Independent review of current head |
|
Tested
AI-assisted review. |
Claimed in the coordination issue as: new BUILD item — #2716 (comment)
What and why
A reviewer on #2610 pointed out that
tools/skin_streams.py:resource_kindstops at the dictionary count checks (#2610 (comment)). The pinned rpf9-explorer'sDrawableDictionaryCheckBytesalso resolves the child-pointer array named by+48: when that array is inside the supplied prefix, its first child must be a system pointer. The Python classifier accepted headers the decoder rejects, counting them as resources before the walker skipped them.This adds that last check. When the array lies beyond the prefix, the decoder accepts without reading it, so this does too. An invalid first child falls through to the other resource kinds, matching the decoder's
LooksLikeResourceorder. Related: #2610 touches the same branch but a different line; no code dependency.Tested
python -I tests/test_skin_streams.py— 28 tests pass, including 4 new synthetic header tests. I watched the two negative tests fail before the fix.python -m compileall -q make_game.py tools testsandgit diff --check— clean.tests/test_report_paths.py, a macOS case-sensitive-volume assertion that fails on Windows path normalization). Our diff touches neither file.data.rpf, all with valid in-prefix first children, so 0 reclassified; resources 2,322 before and after, skipped 80 before and after. No bytes, names or offsets quoted.AI-assisted: OpenCode (Big Pickle model).
Checklist
AI-assisted (OpenCode).