2017.05.02 15:55 "[Tiff] Possible patch/update to allow for a black/white image that has SAMPLEFORMAT tag set", by Michael Shiels
We have run into a number of these and found changing this code in tif_dirread.c but in the older 3.5.6/3.5.7 era code. I don't seem to have saved a copy of one of those images for comparison/testing purposes. But basically the setfield would fail on _SAMPLEFORMAT for a 1bpp image. So we attempt to copy the tag data but do not consider it an error - possibly not best solution, but we needed something quick in our case.
case TIFFTAG_DATATYPE:
case TIFFTAG_SAMPLEFORMAT:
if
(!TIFFFetchPerSampleShorts(tif, dp, &iv) ||
!TIFFSetField(tif,
dp->tdir_tag, iv))
goto bad;
break;
To this
case TIFFTAG_DATATYPE:
if
(!TIFFFetchPerSampleShorts(tif, dp, &iv) ||
!TIFFSetField(tif,
dp->tdir_tag, iv))
goto bad;
break;
case TIFFTAG_SAMPLEFORMAT:
if
(TIFFFetchPerSampleShorts(tif, dp, &iv))
TIFFSetField(tif,
dp->tdir_tag, iv);
break;
Would resolve the issue