diff options
author | Even Rouault <even.rouault@spatialys.com> | 2020-11-21 17:33:59 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2020-11-21 17:33:59 +0000 |
commit | 59e38422f1e0f5c9ead4b3e752a9db2ccd362e02 (patch) | |
tree | 6dde28e6ed06f485111f7d09b450ca057a94fd6f | |
parent | b53b6d9abbb2c1e42e66158ff2efc0bd35075d1a (diff) | |
parent | 6605513d24e49c1276ce4476cd037f714c05244b (diff) | |
download | libtiff-git-59e38422f1e0f5c9ead4b3e752a9db2ccd362e02.tar.gz |
Merge branch 'issue-156' into 'master'
tiff2pdf: Check output size before writing
Closes #156
See merge request libtiff/libtiff!168
-rw-r--r-- | tools/tiff2pdf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index 26064b94..acaef0d6 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -3329,6 +3329,14 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_ break; } + if (TIFFStripSize(output) > t2p->tiff_datasize) { + TIFFError(TIFF2PDF_MODULE, + "Size mismatch input %ld, output %ld", + t2p->tiff_datasize, TIFFStripSize(output)); + _TIFFfree(buffer); + t2p->t2p_error = T2P_ERR_ERROR; + return(0); + } t2p_enable(output); t2p->outputwritten = 0; bufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t) 0, buffer, |