tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr

fixes #220
This commit is contained in:
Thomas Bernard 2020-11-14 12:53:01 +00:00 committed by Even Rouault
parent 2e822691d7
commit 7be2e452dd

View File

@ -2087,10 +2087,18 @@ void t2p_read_tiff_size(T2P* t2p, TIFF* input){
#endif #endif
(void) 0; (void) 0;
} }
#ifdef JPEG_SUPPORT
if(t2p->pdf_compression == T2P_COMPRESS_JPEG
&& t2p->tiff_photometric == PHOTOMETRIC_YCBCR) {
k = checkMultiply64(TIFFNumberOfStrips(input), TIFFStripSize(input), t2p);
} else
#endif
{
k = checkMultiply64(TIFFScanlineSize(input), t2p->tiff_length, t2p); k = checkMultiply64(TIFFScanlineSize(input), t2p->tiff_length, t2p);
if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){ if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
k = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p); k = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p);
} }
}
if (k == 0) { if (k == 0) {
/* Assume we had overflow inside TIFFScanlineSize */ /* Assume we had overflow inside TIFFScanlineSize */
t2p->t2p_error = T2P_ERR_ERROR; t2p->t2p_error = T2P_ERR_ERROR;