Skip to content

Apply image decoder limits before allocation#591

Merged
ryanfowler merged 1 commit into
mainfrom
fix-image-decode-limits
May 26, 2026
Merged

Apply image decoder limits before allocation#591
ryanfowler merged 1 commit into
mainfrom
fix-image-decode-limits

Conversation

@ryanfowler
Copy link
Copy Markdown
Owner

Summary

  • Switched built-in image decoding to image::ImageReader so width, height, and allocation limits are applied before decode() runs.
  • Kept the existing post-decode size check as a defense-in-depth guard.
  • Added a regression test that feeds a valid PNG header with oversized dimensions and asserts it fails with an image limit error before a full image is allocated.

Testing

  • cargo fmt
  • cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo test --all-features
  • cargo test --all-features --test integration -- --test-threads=1

@ryanfowler ryanfowler enabled auto-merge May 26, 2026 02:44
@ryanfowler ryanfowler force-pushed the fix-image-decode-limits branch from 1bbfd93 to 1765936 Compare May 26, 2026 02:55
@ryanfowler ryanfowler merged commit 6342bef into main May 26, 2026
4 checks passed
@ryanfowler ryanfowler deleted the fix-image-decode-limits branch May 26, 2026 02:59
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.

1 participant