summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff/tif_getimage.c
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-04-07 15:22:06 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-04-07 15:22:06 +0300
commit8c5bcabbf6a2e27539c2ad689fd69f2406d5cf5c (patch)
treec94914f103305661850b45164cda5d7313c301e5 /src/3rdparty/libtiff/libtiff/tif_getimage.c
parent90038c936763645610fe1e5f05cfc025e4d98631 (diff)
parent40da7331d6d818ec96604feaf978c8e6e828da7f (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into tqtc/lts-5.15-opensourcev5.15.4-lts-lgpl
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_getimage.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_getimage.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_getimage.c b/src/3rdparty/libtiff/libtiff/tif_getimage.c
index 4da785d..3460af7 100644
--- a/src/3rdparty/libtiff/libtiff/tif_getimage.c
+++ b/src/3rdparty/libtiff/libtiff/tif_getimage.c
@@ -29,6 +29,7 @@
*/
#include "tiffiop.h"
#include <stdio.h>
+#include <limits.h>
static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
@@ -645,12 +646,20 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
flip = setorientation(img);
if (flip & FLIP_VERTICALLY) {
- y = h - 1;
- toskew = -(int32)(tw + w);
+ if ((tw + w) > INT_MAX) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
+ return (0);
+ }
+ y = h - 1;
+ toskew = -(int32)(tw + w);
}
else {
- y = 0;
- toskew = -(int32)(tw - w);
+ if (tw > (INT_MAX + w)) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
+ return (0);
+ }
+ y = 0;
+ toskew = -(int32)(tw - w);
}
/*
@@ -765,10 +774,18 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
flip = setorientation(img);
if (flip & FLIP_VERTICALLY) {
+ if ((tw + w) > INT_MAX) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
+ return (0);
+ }
y = h - 1;
toskew = -(int32)(tw + w);
}
else {
+ if (tw > (INT_MAX + w)) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
+ return (0);
+ }
y = 0;
toskew = -(int32)(tw - w);
}
@@ -936,6 +953,10 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
flip = setorientation(img);
if (flip & FLIP_VERTICALLY) {
+ if ( w > INT_MAX ) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Width overflow");
+ return (0);
+ }
y = h - 1;
toskew = -(int32)(w + w);
} else {
@@ -1032,6 +1053,10 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
flip = setorientation(img);
if (flip & FLIP_VERTICALLY) {
+ if ( w > INT_MAX ) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Width overflow");
+ return (0);
+ }
y = h - 1;
toskew = -(int32)(w + w);
}