Skip to content

fix: tolerate unexpected EOF in PNG#5

Merged
gregberge merged 2 commits intomainfrom
tolerate-ueof-png
Jan 18, 2026
Merged

fix: tolerate unexpected EOF in PNG#5
gregberge merged 2 commits intomainfrom
tolerate-ueof-png

Conversation

@gregberge
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 18, 2026 17:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request modifies PNG decoding logic to gracefully handle unexpected EOF errors instead of failing. The changes allow processing truncated or corrupted PNG files by treating unexpected EOF conditions as a natural end of data stream.

Changes:

  • Modified read_next_rgba_row to return a boolean indicating success and handle EOF gracefully
  • Added is_unexpected_eof_decode_error helper function to detect EOF errors
  • Converted row processing loops from for loops to while loops that can handle early termination

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/lib.rs Core PNG processing logic updated to tolerate EOF and handle truncated images
test/index.spec.ts Added test cases for truncated PNG files
test/fixtures/weird-diff.png Test fixture: truncated PNG file
test/fixtures/weird-diff-2.png Test fixture: truncated PNG file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gregberge gregberge merged commit c28e11d into main Jan 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants