* tools/tiff2pdf.c: check return code of TIFFGetField() when reading

TIFFTAG_SAMPLESPERPIXEL
This commit is contained in:
Even Rouault 2014-12-21 17:36:36 +00:00
parent 2dae28a91b
commit 29f531aeec
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-12-21 Even Rouault <even.rouault@spatialys.com>
* tools/tiff2pdf.c: check return code of TIFFGetField() when reading
TIFFTAG_SAMPLESPERPIXEL
2014-12-21 Even Rouault <even.rouault@spatialys.com> 2014-12-21 Even Rouault <even.rouault@spatialys.com>
* tools/tiffcp.c: fix crash when converting YCbCr JPEG-compressed to none. * tools/tiffcp.c: fix crash when converting YCbCr JPEG-compressed to none.

View File

@ -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 * 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; t2p->tiff_pages[i].page_tilecount;
if( (TIFFGetField(input, TIFFTAG_PLANARCONFIG, &xuint16) != 0) if( (TIFFGetField(input, TIFFTAG_PLANARCONFIG, &xuint16) != 0)
&& (xuint16 == PLANARCONFIG_SEPARATE ) ){ && (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 ) if( (t2p->tiff_tiles[i].tiles_tilecount % xuint16) != 0 )
{ {
TIFFError( TIFFError(