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