conformance: reject invalid critical PNG chunk structure #2213

Closed
leonida/mandy
whoalin1 wants to merge 0 commits from conformance-png-critical-chunks into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

whoalin1 commented 2026-11-26 06:21:57 +00:00

Summary

  • reject PNG chunk types that are not four ASCII letters
  • reject unknown critical chunks, duplicate IHDR/PLTE, invalid or misplaced PLTE, non-consecutive IDAT, and non-empty IEND
  • keep consecutive IDAT chunks and valid ancillary chunks supported
  • add synthetic malformed-structure and valid-structure regressions

Item: CONFORMANCE-PNG-CRITICAL-CHUNKS

This carries forward the still-uncarried fix in old-pr/9989, originally written by lucastayaralvarenga-ui, reapplied and verified on current main.

Tests

Under the local machine coordination lock:

  • control: the new malformed-structure regressions fail on the unpatched reader (10 failing subcases)
  • fixed: python -I tests/test_conformance_png_transparency.py — 6 tests, OK
  • python -I tools/conformance/compare.py selftest — pass
  • python -m compileall -q tools/conformance/compare.py tests/test_conformance_png_transparency.py — pass
  • git diff --cached --check — pass

No game files or GPU.

AI-assisted with Devin.

## Summary - reject PNG chunk types that are not four ASCII letters - reject unknown critical chunks, duplicate IHDR/PLTE, invalid or misplaced PLTE, non-consecutive IDAT, and non-empty IEND - keep consecutive IDAT chunks and valid ancillary chunks supported - add synthetic malformed-structure and valid-structure regressions Item: CONFORMANCE-PNG-CRITICAL-CHUNKS This carries forward the still-uncarried fix in old-pr/9989, originally written by lucastayaralvarenga-ui, reapplied and verified on current main. ## Tests Under the local machine coordination lock: - control: the new malformed-structure regressions fail on the unpatched reader (10 failing subcases) - fixed: `python -I tests/test_conformance_png_transparency.py` — 6 tests, OK - `python -I tools/conformance/compare.py selftest` — pass - `python -m compileall -q tools/conformance/compare.py tests/test_conformance_png_transparency.py` — pass - `git diff --cached --check` — pass No game files or GPU. AI-assisted with Devin.
real-rusher commented 2026-11-26 10:06:25 +00:00

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly, also together with #2212 (both touch tools/conformance/compare.py). With this PR, python -I tests/test_conformance_png_transparency.py: 6 tests OK. The PR's test file against main's compare.py: 10 failing subtests, so the new checks fail on main and pass with the fix. compileall clean.

AI-assisted: yes (Claude Code)

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly, also together with #2212 (both touch tools/conformance/compare.py). With this PR, python -I tests/test_conformance_png_transparency.py: 6 tests OK. The PR's test file against main's compare.py: 10 failing subtests, so the new checks fail on main and pass with the fix. compileall clean. AI-assisted: yes (Claude Code)
DeadlyChirp commented 2026-11-26 10:50:09 +00:00

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_conformance_png_transparency.py: 6 passed, 12 subtests passed (main: 4 passed, 2 subtests).

(AI-assisted test run; output checked by hand.)

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_conformance_png_transparency.py`: 6 passed, 12 subtests passed (main: 4 passed, 2 subtests). (AI-assisted test run; output checked by hand.)
whoalin1 commented 2026-11-26 13:25:20 +00:00

Consolidated into #2205 as cherry-pick dbfcd31ab to reduce review noise. The critical-PNG-chunk validation and regression tests are preserved there.

Consolidated into #2205 as cherry-pick `dbfcd31ab` to reduce review noise. The critical-PNG-chunk validation and regression tests are preserved there.
Sign in to join this conversation.
No description provided.