tif_ojpeg.c: relax again too strict sanity checks to allow reading of valid images such as https://gitlab.com/libtiff/libtiff/-/issues/181#note_302535232. Fixes #181

This commit is contained in:
Even Rouault 2020-03-10 16:31:41 +01:00
parent ae054d59ae
commit 1120a2d578
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D

View File

@ -1263,15 +1263,12 @@ OJPEGWriteHeaderInfo(TIFF* tif)
}
if (jpeg_start_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)
return(0);
if(sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width ||
sp->libjpeg_jpeg_decompress_struct.image_height < sp->strile_length) {
if(sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width ) {
TIFFErrorExt(tif->tif_clientdata,module,
"jpeg_start_decompress() returned image_width = %d "
"and image_height = %d, expected %d and %d",
"jpeg_start_decompress() returned image_width = %d, "
"expected %d",
sp->libjpeg_jpeg_decompress_struct.image_width,
sp->libjpeg_jpeg_decompress_struct.image_height,
sp->strile_width,
sp->strile_length);
sp->strile_width);
return 0;
}
if(sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor != sp->subsampling_hor ||