Skip to content

fix: avoid panic multi planar tif images #2492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

swarnimarun
Copy link
Contributor

@swarnimarun swarnimarun commented Jun 17, 2025

Motivation

Avoid panics for tif images with multi planar configuration.

todo

  • Fail early on decode for tif images with multi planar support, otherwise it may produce a panic
  • Provide test cases.

I have just made a fix for usage by a company I work at, lmk if you folks would prefer it fixed in some other way.

It's a draft as it hasn't quite been extensively tested, yet. And might require more changes to target only cases which aren't quite supported correctly.

Lmk if you folks want any other changes.

Fixes #2179

@swarnimarun swarnimarun marked this pull request as ready for review June 18, 2025 10:41
Copy link
Member

@197g 197g left a comment

Choose a reason for hiding this comment

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

Looks fine to me, much better than a late error and consistency panics.

@197g
Copy link
Member

197g commented Jun 20, 2025

Separately, I'm looking if we can get planar support within months not for ImageBuffer but a separate target buffer) since planar RGB is decently common across formats. Then an appropriate conversion should be a no-brainer and we could retrofit hopefully.

@197g 197g merged commit 96352c4 into image-rs:main Jun 20, 2025
32 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.

Thread panicking in TiffReader::read_image()
2 participants