diff options
author | Even Rouault <even.rouault@spatialys.com> | 2021-12-17 22:24:23 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2021-12-17 22:24:23 +0000 |
commit | 794790068951b5de272f2ac959679f9e4cd7836c (patch) | |
tree | 33b943ef9f55824c1fd108ad39e8170998cd7f82 | |
parent | bd72135a4e116501203a07aa7ab258415df6cedd (diff) | |
parent | 77ea50bba05935c2d966922a9b2e24cf4de8df17 (diff) | |
download | libtiff-git-794790068951b5de272f2ac959679f9e4cd7836c.tar.gz |
Merge branch 'fix_342' into 'master'
TIFFGetField(TIFFTAG_STRIPBYTECOUNTS/TIFFTAG_STRIPOFFSETS): return error if...
Closes #342
See merge request libtiff/libtiff!283
-rw-r--r-- | libtiff/tif_dir.c | 4 | ||||
-rw-r--r-- | tools/tiff2pdf.c | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c index f8fb32d0..6dda9634 100644 --- a/libtiff/tif_dir.c +++ b/libtiff/tif_dir.c @@ -1041,11 +1041,15 @@ _TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap) case TIFFTAG_TILEOFFSETS: _TIFFFillStriles( tif ); *va_arg(ap, const uint64_t**) = td->td_stripoffset_p; + if( td->td_stripoffset_p == NULL ) + ret_val = 0; break; case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEBYTECOUNTS: _TIFFFillStriles( tif ); *va_arg(ap, const uint64_t**) = td->td_stripbytecount_p; + if( td->td_stripbytecount_p == NULL ) + ret_val = 0; break; case TIFFTAG_MATTEING: *va_arg(ap, uint16_t*) = diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index 99c2cc8e..0bd909fb 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -1991,7 +1991,13 @@ void t2p_read_tiff_size(T2P* t2p, TIFF* input){ if(t2p->pdf_compression == T2P_COMPRESS_ZIP) #endif { - TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); + if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ + TIFFError(TIFF2PDF_MODULE, + "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", + TIFFFileName(input)); + t2p->t2p_error = T2P_ERR_ERROR; + return; + } t2p_set_tiff_datasize(t2p, sbc[0]); return; } |