Conformance reader rejects invalid critical PNG chunk structure #259

Closed
github-bot wants to merge 2 commits from github-bot/gh-259 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:54 UTC · original
ubiquitarianism:old-pr/9989 → main · +52 −0 · 2 files · 2 commits · closed without merging

Carried over from old PR 9989 by lucastayaralvarenga-ui in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9989, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
lucastayaralvarenga-ui: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Restores #7181 after the repository-transfer closure. The original PR cannot be reopened by its author (viewerCanReopen: false). This resubmission uses the same branch and unchanged head 48a5f2bd9bf1183f334e797e21bbef19039902f3. Original independent review/test evidence: https://github.com/ProjectLeonida/Leonida/pull/7181#issuecomment-7108237560.

The PNG reader accepted duplicate headers, unsupported critical chunks, split IDAT sequences, a nonempty IEND, and malformed or misplaced palettes. It now rejects these inputs before using their pixels in a comparison. Following review, chunk types must also contain four ASCII letters, so names such as 1234 cannot be treated as ancillary chunks.

Coordination claim. The checks follow PNG chunk ordering and critical chunk definitions. Valid RGB/RGBA images still support consecutive split IDAT chunks, including empty pieces, optional palettes and ancillary text.

Rebased onto main 1ce6eb5f5. Tested head 48a5f2bd9 on Windows with Python 3.12.16 and synthetic pixels only: all 6 focused tests and the 22-check compare.py selftest pass. The three new invalid-name cases fail against the rebased version before the review fix; the original seven invalid-structure cases were also verified against the original parent. Compilation, diff whitespace and game-data checks pass. CPU-only, no GPU run.

AI-assisted (Codex).

Fresh integration verification against ProjectLeonida/Leonida main "d083a2cc3": clean merge, tests/test_conformance_png_transparency.py: 6 tests; compare.py selftest: all 22 checks passed. Whitespace and changed-file game-data checks passed. Windows, Python 3.12.16, CPU only, synthetic inputs; no GPU run. AI-assisted (Codex).

Resubmission claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116960294

**@⁠Andretuta** on GitHub · 2026-11-24 02:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/259) `ubiquitarianism:old-pr/9989` → `main` · +52 −0 · 2 files · 2 commits · closed without merging > Carried over from **old PR 9989** by `lucastayaralvarenga-ui` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9989`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `lucastayaralvarenga-ui`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Restores `#7181` after the repository-transfer closure. The original PR cannot be reopened by its author (`viewerCanReopen: false`). This resubmission uses the same branch and unchanged head `48a5f2bd9bf1183f334e797e21bbef19039902f3`. Original independent review/test evidence: https://github.com/ProjectLeonida/Leonida/pull/7181#issuecomment-7108237560. The PNG reader accepted duplicate headers, unsupported critical chunks, split IDAT sequences, a nonempty IEND, and malformed or misplaced palettes. It now rejects these inputs before using their pixels in a comparison. Following review, chunk types must also contain four ASCII letters, so names such as `1234` cannot be treated as ancillary chunks. [Coordination claim](https://github.com/ProjectLeonida/Leonida/issues/7049#issuecomment-7106575790). The checks follow [PNG chunk ordering](https://www.w3.org/TR/png-3/#5ChunkOrdering) and [critical chunk definitions](https://www.w3.org/TR/png-3/#11Critical-chunks). Valid RGB/RGBA images still support consecutive split IDAT chunks, including empty pieces, optional palettes and ancillary text. Rebased onto main `1ce6eb5f5`. Tested head `48a5f2bd9` on Windows with Python 3.12.16 and synthetic pixels only: all 6 focused tests and the 22-check compare.py selftest pass. The three new invalid-name cases fail against the rebased version before the review fix; the original seven invalid-structure cases were also verified against the original parent. Compilation, diff whitespace and game-data checks pass. CPU-only, no GPU run. AI-assisted (Codex). Fresh integration verification against ProjectLeonida/Leonida main "d083a2cc3": clean merge, tests/test_conformance_png_transparency.py: 6 tests; compare.py selftest: all 22 checks passed. Whitespace and changed-file game-data checks passed. Windows, Python 3.12.16, CPU only, synthetic inputs; no GPU run. AI-assisted (Codex). Resubmission claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116960294
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:50:51 +00:00
Author
Owner

@⁠fin-github on GitHub · 2026-11-24 21:58 UTC · original

Taken over in #1331: the same commits cherry-picked onto current main with -x, original author kept, tests rerun there (they still fail on main without the change). The draft can be closed as #17 describes. AI-assisted (Claude Code).

**@⁠fin-github** on GitHub · 2026-11-24 21:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/259#issuecomment-7145633475) Taken over in #1331: the same commits cherry-picked onto current `main` with `-x`, original author kept, tests rerun there (they still fail on `main` without the change). The draft can be closed as #17 describes. AI-assisted (Claude Code).
github-bot closed this pull request 2026-11-27 04:04:17 +00:00
Author
Owner

@⁠Andretuta on GitHub · 2026-11-27 04:01 UTC · original

Closing carried-over draft: taken over in #1331 (OLD-9989).

**@⁠Andretuta** on GitHub · 2026-11-27 04:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/259#issuecomment-7209464094) Closing carried-over draft: taken over in #1331 (OLD-9989).

Pull request closed

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