summaryrefslogtreecommitdiff
path: root/tools/tiff2pdf.c
diff options
context:
space:
mode:
authorThomas Bernard <miniupnp@free.fr>2019-02-13 15:13:21 +0100
committerThomas Bernard <miniupnp@free.fr>2019-02-28 13:44:49 +0100
commitea2e933b17078a6517f1ee888ea4da72fa1104b1 (patch)
tree21cc1d866a7f46184e66bebfd9deffb4784b89ae /tools/tiff2pdf.c
parente3d738277b5c7ec23c33294435d1bbbd152f77b8 (diff)
downloadlibtiff-git-ea2e933b17078a6517f1ee888ea4da72fa1104b1.tar.gz
tiff2pdf.c: don't call t2p_tile_collapse_left() when buffer size is wrong
see http://bugzilla.maptools.org/show_bug.cgi?id=2785
Diffstat (limited to 'tools/tiff2pdf.c')
-rw-r--r--tools/tiff2pdf.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index f3213ce6..76539925 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -3118,19 +3118,26 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
if(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){
t2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(
- (tdata_t)buffer,
+ (tdata_t)buffer,
t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth
*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
}
}
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) != 0){
- t2p_tile_collapse_left(
- buffer,
- TIFFTileRowSize(input),
- t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth,
- t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth,
- t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+ if ((uint64)t2p->tiff_datasize < (uint64)TIFFTileRowSize(input) * (uint64)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength) {
+ /* we don't know how to handle PLANARCONFIG_CONTIG, PHOTOMETRIC_YCBCR with 3 samples per pixel */
+ TIFFWarning(
+ TIFF2PDF_MODULE,
+ "Don't know how to collapse tile to the left");
+ } else {
+ t2p_tile_collapse_left(
+ buffer,
+ TIFFTileRowSize(input),
+ t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth,
+ t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth,
+ t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
+ }
}