Skip to content

fix(screenshot): reject invalid PNG header dimensions - #2472

Merged
baron merged 1 commit into
morluto:mainfrom
rudycelekli:fix/png-header-dimensions
Oct 13, 2026
Merged

baron merged 1 commit into
morluto:mainfrom
rudycelekli:fix/png-header-dimensions

Conversation

@rudycelekli

Copy link
Copy Markdown

The shared screenshot header reader accepts an IHDR with a data length other than 13 and dimensions above PNG's permitted 2^31−1 maximum. Both CDP screenshots and native helper observations can therefore accept impossible metadata when the digest and reported dimensions agree. Validate these header fields at their shared producing boundary, preserving byte fidelity and header-only parsing.

Validation: 12 new regressions fail on the original implementation across the header reader, native-observation consumer and local CDP socket. All 38 focused tests and npm run check pass. The official npm run verify:browser lane passes with real Chrome 155.0.8059.40, including screenshot capture, CLI/MCP parity and verified profile/process cleanup. A prior parallel run hit an unrelated scenario-storage cleanup timeout; the isolated complete rerun passed. Independent automated review passed on 253c0d9.

The PNG IHDR specification defines the header fields and dimension range. This corrects the header reader, distinct from the earlier full PNG checksum/DEFLATE work.

AI assistance: OpenAI Codex authored and reviewed the code, tests, analysis and description. No human review is claimed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Tightens the shared PNG header reader without decoding the full image or changing screenshot bytes.

  • Screenshot headers reject invalid IHDR lengths and oversized dimensions.

No actionable issues found. Tests were inspected but not run during this review.

Reviews (1) · Last reviewed commit: "fix(screenshot): reject invalid PNG head..." · Reviewed by Greptile

@baron
baron merged commit e74e4e9 into morluto:main Oct 13, 2026
35 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added the bug Something isn't working label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants