tiff: Security fix for CVE-2023-40745

Upstream-Status: Backport from [4fc16f649f]
CVE: CVE-2023-40745
(From OE-Core rev: f1aa2dd493c01e18ee0f534ff00523a1274f9066)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Siddharth Doshi
2023-10-17 21:27:42 +05:30
committed by Steve Sakoman
parent 24e9fed15a
commit 6da1e21e9a
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
From 4fc16f649fa2875d5c388cf2edc295510a247ee5 Mon Sep 17 00:00:00 2001
From: Arie Haenel <arie.haenel@jct.ac.il>
Date: Wed, 19 Jul 2023 19:34:25 +0000
Subject: [PATCH] tiffcp: fix memory corruption (overflow) on hostile images
(fixes #591)
Upstream-Status: Backport from [https://gitlab.com/libtiff/libtiff/-/commit/4fc16f649fa2875d5c388cf2edc295510a247ee5]
CVE: CVE-2023-40745
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
tools/tiffcp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index 57eef90..34b6ef2 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -1577,6 +1577,13 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer)
TIFFError(TIFFFileName(in), "Error, cannot handle that much samples per tile row (Tile Width * Samples/Pixel)");
return 0;
}
+
+ if ( (imagew - tilew * spp) > INT_MAX ){
+ TIFFError(TIFFFileName(in),
+ "Error, image raster scan line size is too large");
+ return 0;
+ }
+
iskew = imagew - tilew*spp;
tilebuf = limitMalloc(tilesize);
if (tilebuf == 0)
--
2.25.1

View File

@@ -45,6 +45,7 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
file://CVE-2023-26966.patch \
file://CVE-2022-40090.patch \
file://CVE-2023-1916.patch \
file://CVE-2023-40745.patch \
"
SRC_URI[sha256sum] = "0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8"