summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/libtiff/files/CVE-2023-41175.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/libtiff/files/CVE-2023-41175.patch')
-rw-r--r--meta/recipes-multimedia/libtiff/files/CVE-2023-41175.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/libtiff/files/CVE-2023-41175.patch b/meta/recipes-multimedia/libtiff/files/CVE-2023-41175.patch
new file mode 100644
index 0000000000..3f44a42012
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/files/CVE-2023-41175.patch
@@ -0,0 +1,67 @@
1From 4cc97e3dfa6559f4d17af0d0687bcae07ca4b73d Mon Sep 17 00:00:00 2001
2From: Arie Haenel <arie.haenel@jct.ac.il>
3Date: Wed, 19 Jul 2023 19:40:01 +0000
4Subject: raw2tiff: fix integer overflow and bypass of the check (fixes #592)
5
6Upstream-Status: Backport [import from debian security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u8.debian.tar.xz
7Upstream commit https://gitlab.com/libtiff/libtiff/-/commit/6e2dac5f904496d127c92ddc4e56eccfca25c2ee]
8CVE: CVE-2023-41175
9Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
10---
11 tools/raw2tiff.c | 26 ++++++++++++++++++++++++++
12 1 file changed, 26 insertions(+)
13
14diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c
15index ab36ff4e..a905da52 100644
16--- a/tools/raw2tiff.c
17+++ b/tools/raw2tiff.c
18@@ -35,6 +35,7 @@
19 #include <sys/types.h>
20 #include <math.h>
21 #include <ctype.h>
22+#include <limits.h>
23
24 #ifdef HAVE_UNISTD_H
25 # include <unistd.h>
26@@ -101,6 +102,7 @@ main(int argc, char* argv[])
27 int fd;
28 char *outfilename = NULL;
29 TIFF *out;
30+ uint32 temp_limit_check = 0;
31
32 uint32 row, col, band;
33 int c;
34@@ -212,6 +214,30 @@ main(int argc, char* argv[])
35 if (guessSize(fd, dtype, hdr_size, nbands, swab, &width, &length) < 0)
36 return 1;
37
38+ if ((width == 0) || (length == 0) ){
39+ fprintf(stderr, "Too large nbands value specified.\n");
40+ return (EXIT_FAILURE);
41+ }
42+
43+ temp_limit_check = nbands * depth;
44+
45+ if ( !temp_limit_check || length > ( UINT_MAX / temp_limit_check ) ) {
46+ fprintf(stderr, "Too large length size specified.\n");
47+ return (EXIT_FAILURE);
48+ }
49+ temp_limit_check = temp_limit_check * length;
50+
51+ if ( !temp_limit_check || width > ( UINT_MAX / temp_limit_check ) ) {
52+ fprintf(stderr, "Too large width size specified.\n");
53+ return (EXIT_FAILURE);
54+ }
55+ temp_limit_check = temp_limit_check * width;
56+
57+ if ( !temp_limit_check || hdr_size > ( UINT_MAX - temp_limit_check ) ) {
58+ fprintf(stderr, "Too large header size specified.\n");
59+ return (EXIT_FAILURE);
60+ }
61+
62 if (outfilename == NULL)
63 outfilename = argv[optind+1];
64 out = TIFFOpen(outfilename, "w");
65--
662.30.2
67