38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
|
From a28b2e1b23fc936989dc4bbc857e9a8a851c5ff0 Mon Sep 17 00:00:00 2001
|
||
|
From: Even Rouault <even.rouault@spatialys.com>
|
||
|
Date: Tue, 8 Nov 2022 15:16:58 +0100
|
||
|
Subject: [PATCH] (CVE-2022-3970) TIFFReadRGBATileExt(): fix (unsigned) integer
|
||
|
overflow on strips/tiles > 2 GB
|
||
|
|
||
|
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53137
|
||
|
|
||
|
(cherry picked from commit 227500897dfb07fb7d27f7aa570050e62617e3be)
|
||
|
---
|
||
|
libtiff/tif_getimage.c | 8 ++++----
|
||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
|
||
|
index b1f7cc95..00cd5510 100644
|
||
|
--- a/libtiff/tif_getimage.c
|
||
|
+++ b/libtiff/tif_getimage.c
|
||
|
@@ -3044,15 +3044,15 @@ TIFFReadRGBATileExt(TIFF* tif, uint32 col, uint32 row, uint32 * raster, int stop
|
||
|
return( ok );
|
||
|
|
||
|
for( i_row = 0; i_row < read_ysize; i_row++ ) {
|
||
|
- memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||
|
- raster + (read_ysize - i_row - 1) * read_xsize,
|
||
|
+ memmove( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize,
|
||
|
+ raster + (size_t)(read_ysize - i_row - 1) * read_xsize,
|
||
|
read_xsize * sizeof(uint32) );
|
||
|
- _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,
|
||
|
+ _TIFFmemset( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize+read_xsize,
|
||
|
0, sizeof(uint32) * (tile_xsize - read_xsize) );
|
||
|
}
|
||
|
|
||
|
for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
|
||
|
- _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||
|
+ _TIFFmemset( raster + (size_t)(tile_ysize - i_row - 1) * tile_xsize,
|
||
|
0, sizeof(uint32) * tile_xsize );
|
||
|
}
|
||
|
|