Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #5157
Updated libtiff to 4.2.0, adding a setting to 'winbuild/tiff.opt' because of https://gitlab.com/libtiff/libtiff/-/commit/58b16f47a82323c05ec81f0a821700beb8c2c5a0 (later simplified).
However, from the first commit here, you can see that a test fails.
Investigating, it is failing specifically because of
Pillow/Tests/test_file_libtiff.py
Line 256 in 18ee51a
libtiff 4.2.0 added the 'Rational2Double' block in this code (if you're interested, it was part of https://gitlab.com/Su_Laus/libtiff/-/commit/6df997c786928757caea0dd68d26ea5f098f49df) -
These lines are returning zero for
tv_size
- I conclude it is becausefip->set_field_type
is not properly set from https://gitlab.com/libtiff/libtiff/-/blob/v4.2.0/libtiff/tif_dirinfo.c#L1106-1109 inTIFFMergeFieldInfo
.This is because
_TIFFSetGetType
has a few conditions to match againstTIFF_RATIONAL
-but none involve
count
(readcount
in TiffDecode.c) being zero.Pillow/src/libImaging/TiffDecode.c
Line 581 in 18ee51a
So this PR changes that value, and the test now passes.
This also then fixes python-pillow/pillow-wheels#180.