diff --git a/ChangeLog b/ChangeLog index ef0dceff..c7bb607a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-12-21 Even Rouault + + * tools/tiff2pdf.c: check return code of TIFFGetField() when reading + TIFFTAG_SAMPLESPERPIXEL + 2014-12-21 Even Rouault * tools/tiffcp.c: fix crash when converting YCbCr JPEG-compressed to none. diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index ea3d5bd7..8482f907 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -1,4 +1,4 @@ -/* $Id: tiff2pdf.c,v 1.78 2014-12-21 15:15:32 erouault Exp $ +/* $Id: tiff2pdf.c,v 1.79 2014-12-21 17:36:36 erouault Exp $ * * tiff2pdf - converts a TIFF image to a PDF document * @@ -1166,7 +1166,15 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){ t2p->tiff_pages[i].page_tilecount; if( (TIFFGetField(input, TIFFTAG_PLANARCONFIG, &xuint16) != 0) && (xuint16 == PLANARCONFIG_SEPARATE ) ){ - TIFFGetField(input, TIFFTAG_SAMPLESPERPIXEL, &xuint16); + if( !TIFFGetField(input, TIFFTAG_SAMPLESPERPIXEL, &xuint16) ) + { + TIFFError( + TIFF2PDF_MODULE, + "Missing SamplesPerPixel, %s", + TIFFFileName(input)); + t2p->t2p_error = T2P_ERR_ERROR; + return; + } if( (t2p->tiff_tiles[i].tiles_tilecount % xuint16) != 0 ) { TIFFError(