conformance: reject invalid critical PNG chunk structure #2213

Closed
github-bot wants to merge 1 commit from github-bot/gh-2213 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-26 06:21 UTC · original
whoalin1:conformance-png-critical-chunks → main · +52 −0 · 2 files · 1 commits · closed without merging

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.

**@⁠whoalin1** on GitHub · 2026-11-26 06:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2213) `whoalin1:conformance-png-critical-chunks` → `main` · +52 −0 · 2 files · 1 commits · closed without merging ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:22:29 +00:00
Author
Owner

@⁠real-rusher on GitHub · 2026-11-26 10:06 UTC · original

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)

**@⁠real-rusher** on GitHub · 2026-11-26 10:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2213#issuecomment-7188915723) 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)
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-26 10:50 UTC · original

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.)

**@⁠DeadlyChirp** on GitHub · 2026-11-26 10:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2213#issuecomment-7189900765) 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.)
github-bot closed this pull request 2026-11-26 13:26:23 +00:00
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-26 13:25 UTC · original

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

**@⁠whoalin1** on GitHub · 2026-11-26 13:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2213#issuecomment-7193328681) Consolidated into #2205 as cherry-pick `dbfcd31ab` to reduce review noise. The critical-PNG-chunk validation and regression tests are preserved there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.