Index: tools/tiff2pdf.c =================================================================== --- tools/tiff2pdf.c.orig +++ tools/tiff2pdf.c @@ -2436,7 +2436,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p TIFFReadEncodedStrip(input, i, (tdata_t) &buffer[bufferoffset], - stripsize); + TIFFmin(stripsize, t2p->tiff_datasize - bufferoffset)); if(read==-1){ TIFFError(TIFF2PDF_MODULE, "Error on decoding strip %u of %s",