|
| 1 | +From c13d9af1d963fb9a98f241622dec80833977590b Mon Sep 17 00:00:00 2001 |
| 2 | +From: Lee Howard < [email protected]> |
| 3 | +Date: Sat, 5 Oct 2024 09:45:30 -0700 |
| 4 | +Subject: [PATCH] Check TIFFTAG_TILELENGTH and TIFFTAGTILEWIDTH for valid |
| 5 | + input, addresses issue #650 |
| 6 | + |
| 7 | +Signed-off-by: Azure Linux Security Servicing Account < [email protected]> |
| 8 | +Upstream-reference: https://gitlab.com/libtiff/libtiff/-/commit/2ebfffb0e8836bfb1cd7d85c059cd285c59761a4.patch |
| 9 | +--- |
| 10 | + tools/unsupported/tiff2pdf.c | 16 ++++++++++++++++ |
| 11 | + 1 file changed, 16 insertions(+) |
| 12 | + |
| 13 | +diff --git a/tools/unsupported/tiff2pdf.c b/tools/unsupported/tiff2pdf.c |
| 14 | +index 1dbdc87..9ab4a9b 100644 |
| 15 | +--- a/tools/unsupported/tiff2pdf.c |
| 16 | ++++ b/tools/unsupported/tiff2pdf.c |
| 17 | +@@ -1337,8 +1337,24 @@ void t2p_read_tiff_init(T2P *t2p, TIFF *input) |
| 18 | + t2p->pdf_xrefcount += (t2p->tiff_tiles[i].tiles_tilecount - 1) * 2; |
| 19 | + TIFFGetField(input, TIFFTAG_TILEWIDTH, |
| 20 | + &(t2p->tiff_tiles[i].tiles_tilewidth)); |
| 21 | ++ if (t2p->tiff_tiles[i].tiles_tilewidth < 1) |
| 22 | ++ { |
| 23 | ++ TIFFError(TIFF2PDF_MODULE, "Invalid tile width (%d), %s", |
| 24 | ++ t2p->tiff_tiles[i].tiles_tilewidth, |
| 25 | ++ TIFFFileName(input)); |
| 26 | ++ t2p->t2p_error = T2P_ERR_ERROR; |
| 27 | ++ return; |
| 28 | ++ } |
| 29 | + TIFFGetField(input, TIFFTAG_TILELENGTH, |
| 30 | + &(t2p->tiff_tiles[i].tiles_tilelength)); |
| 31 | ++ if (t2p->tiff_tiles[i].tiles_tilelength < 1) |
| 32 | ++ { |
| 33 | ++ TIFFError(TIFF2PDF_MODULE, "Invalid tile length (%d), %s", |
| 34 | ++ t2p->tiff_tiles[i].tiles_tilelength, |
| 35 | ++ TIFFFileName(input)); |
| 36 | ++ t2p->t2p_error = T2P_ERR_ERROR; |
| 37 | ++ return; |
| 38 | ++ } |
| 39 | + t2p->tiff_tiles[i].tiles_tiles = (T2P_TILE *)_TIFFmalloc( |
| 40 | + TIFFSafeMultiply(tmsize_t, t2p->tiff_tiles[i].tiles_tilecount, |
| 41 | + sizeof(T2P_TILE))); |
| 42 | +-- |
| 43 | +2.45.4 |
| 44 | + |
0 commit comments