8000 Fix libtiff 4.7 compat by jcupitt · Pull Request #4319 · libvips/libvips · GitHub
[go: up one dir, main page]

Skip to content

Fix libtiff 4.7 compat #4319

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

Closed
wants to merge 1 commit into from
Closed

Fix libtiff 4.7 compat #4319

wants to merge 1 commit into from

Conversation

jcupitt
Copy link
Member
@jcupitt jcupitt commented Dec 13, 2024

libtiff 4.7 now returns -1 for some warnings

Don't bail out if TIFFReadScanline() and TIFFReadEncodedStrip() return -1.
libtiff 4.7.0 and maybe earlier have started returning error values for
truncated strips.

Maybe other API points now return error codes for warnings too?

see #4317

Don't bail out if TIFFReadScanline() and TIFFReadEncodedStrip() return -1.
libtiff 4.7.0 and maybe earlier have started returning error values for
truncated strips.

Maybe other API points now return error codes for warnings too?

see #4317
@jcupitt jcupitt force-pushed the fix-libtif-4.7-compat branch from ed5f6c4 to 140d14f Compare December 13, 2024 15:28
@jcupitt jcupitt changed the base branch from master to 8.16 December 13, 2024 15:29
@lovell
Copy link
Member
lovell commented Dec 14, 2024

I think https://gitlab.com/libtiff/libtiff/-/merge_requests/628 might be the upstream change, which appears to zero out any scan lines that cannot be decoded due to the warning. Is it safe to ignore the return code with older versions of libtiff?

@jcupitt
Copy link
Member Author
jcupitt commented Dec 14, 2024

Ah it's all unclear. Thinking about this again, I think (I think!) libtiff policy is to only return error codes for unrecoverable errors and not for warnings, so this change is probably a libtiff bug.

I suppose in that case you're right and we should just #ifdef this workaround for 4.7.0. I'll ask on the libtiff mailing list.

@jcupitt
Copy link
Member Author
jcupitt commented Dec 14, 2024

Test file from linked issue for reference:

https://github.com/user-attachments/files/18116811/error_tiff.zip

With libtiff 4.7.0, TIFFReadScanline() returns -1 for scanline 7212, while earlier libtiffs keep on trucking and just issue warnings.

@jcupitt
Copy link
Member Author
jcupitt commented Dec 14, 2024

I made an issue on libtiff, let's see what they say.

https://gitlab.com/libtiff/libtiff/-/issues/657

@jcupitt
Copy link
Member Author
jcupitt commented Dec 17, 2024

The result of the libtiff discussion is that we need to revise our error handling in tiff2vips. Read functions like TIFFReadScanline() can return non-zero for recoverable errors (though not always), so we should not unconditionally fail, but instead test fail-on.

@lovell
Copy link
Member
lovell commented Dec 18, 2024

It sounds like this could build quite nicely on top of #4313, so perhaps we should target this fix at 8.17/master?

@jcupitt
Copy link
Member Author
jcupitt commented Dec 22, 2024

I agree, let's junk this and try again on master with a more serious reworking of libtiff error handling. I'll make an issue so this isn't forgotten.

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
0