Skip to content

reject a dxbc part inside the header or part table - #1944

Open
imjustprism wants to merge 1 commit into
Marvisak:mainfrom
imjustprism:fix/dxbc-part-inside-table
Open

imjustprism wants to merge 1 commit into
Marvisak:mainfrom
imjustprism:fix/dxbc-part-inside-table

Conversation

@imjustprism

Copy link
Copy Markdown
Contributor

a part offset that points into the container header or the offset table was accepted: offset 0 came back as a part with the container magic as its fourcc. parts follow the table, so an offset before its end is now refused as malformed. #343 refuses parts that overlap each other, which does not catch this.

the reporter had the same check on a fork and could not open a pull request; this one is written against current main, with a test for the header case and the table case. both fail without the check.

fixes #777

@Headache3318

Copy link
Copy Markdown

Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head cba87ae applied cleanly onto current main ccfb029.

  • cargo test -p victory-shader --locked: 145 passed, 0 failed, 2 ignored. All tests pass.
  • cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: 4 errors in test code (unused imports, unused variable, dead field rovs), but these are pre-existing on main — they fail identically on ccfb029 without this PR. The PR introduces no new clippy warnings.

Not tested: Windows MSVC build, the title itself. AI-assisted.

@imjustprism
imjustprism force-pushed the fix/dxbc-part-inside-table branch from cba87ae to afc4f79 Compare November 25, 2026 01:36

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.

145 passed / 0 failed / 2 ignored. DXBC parts inside the header/part table rejected (+1 test) — container-validation hardening against malformed shaders.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate.

Container::parse in crates/victory-shader/src/dxbc.rs now refuses a part whose offset lies before the end of the offset table (HEADER_SIZE + 4 * count). This fixes #777, which is labelled confirmed.

On main, offset 0 is accepted as a part tagged DXBC. The new test covers both the header case and the table case and checks the exact error. It uses the existing build helper. The table itself is already bounds-checked by u32_at on the slice cut to the container's size, so this is the remaining gap from #777.

CI: check passes.


Generated by Claude Code

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump

Result: no count change against main.

I merged head afc4f79 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DXBC parser accepts part offsets inside the header or part table

5 participants