summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-12-16 23:57:49 +0100
committerEven Rouault <even.rouault@spatialys.com>2021-12-16 23:57:49 +0100
commite533f45709089b461c622fcb6510843725fb7bcc (patch)
treecbc5b512e0d1b99d627c7d58e4a5f5c5ae922726
parent1d1299a670efb393d077250b5bb00d22c71e8e4c (diff)
downloadlibtiff-git-e533f45709089b461c622fcb6510843725fb7bcc.tar.gz
tiff2pdf: validate TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc) return (fixes #342)
-rw-r--r--tools/tiff2pdf.c8
1 files changed, 7 insertions, 1 deletions
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;
}