fix read of plane-separate, large-strip tiff

TIFFReadScanline() is too fiddly to use on plane-separate, large-strip
images ... ban it!

see https://github.com/jcupitt/libvips/issues/855
This commit is contained in:
John Cupitt 2018-01-12 17:04:47 +00:00
parent 24c07cfde2
commit 94daa18884
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
5/1/18 started 8.6.2
- vips_sink_screen() keeps a ref to the input image ... stops a rare race
- fix a minor accidental ABI break in 8.6.0 -> 8.6.1 [remicollet]
- fix read of plane-separate TIFFs with large strips [remicollet]
10/12/17 started 8.6.1
- fix mmap window new/free cycling

View File

@ -1435,7 +1435,8 @@ rtiff_fill_region_aligned( VipsRegion *out, void *seq, void *a, void *b )
/* Loop over the output region painting in tiles from the file.
*/
static int
rtiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop )
rtiff_fill_region( VipsRegion *out,
void *seq, void *a, void *b, gboolean *stop )
{
tdata_t *buf = (tdata_t *) seq;
Rtiff *rtiff = (Rtiff *) a;
@ -2107,8 +2108,12 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header )
*
* If this image has a strip size of over 128 lines, fall back
* to TIFFReadScanline(), otherwise use TIFFReadEncodedStrip().
*
* Don't do this in plane-separate mode. TIFFReadScanline() is
* too fiddly to use in this case.
*/
if( header->rows_per_strip > 128 ) {
if( header->rows_per_strip > 128 &&
!header->separate ) {
header->rows_per_strip = 1;
header->strip_size = TIFFScanlineSize( rtiff->tiff );
header->number_of_strips = header->height;