summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libraw
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/libraw')
-rw-r--r--meta-oe/recipes-support/libraw/libraw/0001-CVE-2025-43961-CVE-2025-43962.patch108
-rw-r--r--meta-oe/recipes-support/libraw/libraw_0.21.2.bb5
2 files changed, 112 insertions, 1 deletions
diff --git a/meta-oe/recipes-support/libraw/libraw/0001-CVE-2025-43961-CVE-2025-43962.patch b/meta-oe/recipes-support/libraw/libraw/0001-CVE-2025-43961-CVE-2025-43962.patch
new file mode 100644
index 0000000000..1abd302caf
--- /dev/null
+++ b/meta-oe/recipes-support/libraw/libraw/0001-CVE-2025-43961-CVE-2025-43962.patch
@@ -0,0 +1,108 @@
1From 880829f7ed206c21ce05d5772f0928629c7dd577 Mon Sep 17 00:00:00 2001
2From: Alex Tutubalin <lexa@lexa.ru>
3Date: Sat, 1 Feb 2025 15:32:39 +0300
4Subject: [PATCH] CVE-2025-43961 CVE-2025-43962
5
6Prevent out-of-bounds read in fuji 0xf00c tag parser
7
8prevent OOB reads in phase_one_correct
9
10CVE: CVE-2025-43961 CVE-2025-43962
11Upstream-Status: Backport [https://github.com/LibRaw/LibRaw/commit/66fe663e02a4dd610b4e832f5d9af326709336c2]
12
13(cherry picked from commit 66fe663e02a4dd610b4e832f5d9af326709336c2)
14Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
15---
16 src/decoders/load_mfbacks.cpp | 18 ++++++++++++++----
17 src/metadata/tiff.cpp | 28 +++++++++++++++++-----------
18 2 files changed, 31 insertions(+), 15 deletions(-)
19
20diff --git a/src/decoders/load_mfbacks.cpp b/src/decoders/load_mfbacks.cpp
21index cddc33eb..1a1bdfb3 100644
22--- a/src/decoders/load_mfbacks.cpp
23+++ b/src/decoders/load_mfbacks.cpp
24@@ -490,6 +490,9 @@ int LibRaw::phase_one_correct()
25 fseek(ifp, off_412, SEEK_SET);
26 for (i = 0; i < 9; i++)
27 head[i] = get4() & 0x7fff;
28+ unsigned w0 = head[1] * head[3], w1 = head[2] * head[4];
29+ if (w0 > 10240000 || w1 > 10240000)
30+ throw LIBRAW_EXCEPTION_ALLOC;
31 yval[0] = (float *)calloc(head[1] * head[3] + head[2] * head[4], 6);
32 yval[1] = (float *)(yval[0] + head[1] * head[3]);
33 xval[0] = (ushort *)(yval[1] + head[2] * head[4]);
34@@ -514,10 +517,17 @@ int LibRaw::phase_one_correct()
35 for (k = j = 0; j < head[1]; j++)
36 if (num < xval[0][k = head[1] * i + j])
37 break;
38- frac = (j == 0 || j == head[1])
39- ? 0
40- : (xval[0][k] - num) / (xval[0][k] - xval[0][k - 1]);
41- mult[i - cip] = yval[0][k - 1] * frac + yval[0][k] * (1 - frac);
42+ if (j == 0 || j == head[1] || k < 1 || k >= w0+w1)
43+ frac = 0;
44+ else
45+ {
46+ int xdiv = (xval[0][k] - xval[0][k - 1]);
47+ frac = xdiv ? (xval[0][k] - num) / (xval[0][k] - xval[0][k - 1]) : 0;
48+ }
49+ if (k < w0 + w1)
50+ mult[i - cip] = yval[0][k > 0 ? k - 1 : 0] * frac + yval[0][k] * (1 - frac);
51+ else
52+ mult[i - cip] = 0;
53 }
54 i = ((mult[0] * (1 - cfrac) + mult[1] * cfrac) * row + num) * 2;
55 RAW(row, col) = LIM(i, 0, 65535);
56diff --git a/src/metadata/tiff.cpp b/src/metadata/tiff.cpp
57index c34b8647..af664937 100644
58--- a/src/metadata/tiff.cpp
59+++ b/src/metadata/tiff.cpp
60@@ -1032,31 +1032,37 @@ int LibRaw::parse_tiff_ifd(int base)
61 if ((fwb[0] == rafdata[fi]) && (fwb[1] == rafdata[fi + 1]) &&
62 (fwb[2] == rafdata[fi + 2])) // found Tungsten WB
63 {
64- if (rafdata[fi - 15] !=
65+ if (fi > 14 && rafdata[fi - 15] !=
66 fwb[0]) // 15 is offset of Tungsten WB from the first
67 // preset, Fine Weather WB
68 continue;
69- for (int wb_ind = 0, ofst = fi - 15; wb_ind < (int)Fuji_wb_list1.size();
70- wb_ind++, ofst += 3)
71- {
72- icWBC[Fuji_wb_list1[wb_ind]][1] =
73- icWBC[Fuji_wb_list1[wb_ind]][3] = rafdata[ofst];
74- icWBC[Fuji_wb_list1[wb_ind]][0] = rafdata[ofst + 1];
75- icWBC[Fuji_wb_list1[wb_ind]][2] = rafdata[ofst + 2];
76- }
77+ if (fi >= 15)
78+ {
79+ for (int wb_ind = 0, ofst = fi - 15; wb_ind < (int)Fuji_wb_list1.size();
80+ wb_ind++, ofst += 3)
81+ {
82+ icWBC[Fuji_wb_list1[wb_ind]][1] =
83+ icWBC[Fuji_wb_list1[wb_ind]][3] = rafdata[ofst];
84+ icWBC[Fuji_wb_list1[wb_ind]][0] = rafdata[ofst + 1];
85+ icWBC[Fuji_wb_list1[wb_ind]][2] = rafdata[ofst + 2];
86+ }
87+ }
88
89 if (is34)
90 fi += 24;
91 fi += 96;
92 for (fj = fi; fj < (fi + 15); fj += 3) // looking for the end of the WB table
93 {
94+ if (fj > libraw_internal_data.unpacker_data.lenRAFData - 3)
95+ break;
96 if (rafdata[fj] != rafdata[fi])
97 {
98 fj -= 93;
99 if (is34)
100 fj -= 9;
101-// printf ("wb start in DNG: 0x%04x\n", fj*2-0x4e);
102- for (int iCCT = 0, ofst = fj; iCCT < 31;
103+//printf ("wb start in DNG: 0x%04x\n", fj*2-0x4e);
104+ for (int iCCT = 0, ofst = fj; iCCT < 31
105+ && ofst < libraw_internal_data.unpacker_data.lenRAFData - 3;
106 iCCT++, ofst += 3)
107 {
108 icWBCCTC[iCCT][0] = FujiCCT_K[iCCT];
diff --git a/meta-oe/recipes-support/libraw/libraw_0.21.2.bb b/meta-oe/recipes-support/libraw/libraw_0.21.2.bb
index 4d089f3b79..c6d9acb960 100644
--- a/meta-oe/recipes-support/libraw/libraw_0.21.2.bb
+++ b/meta-oe/recipes-support/libraw/libraw_0.21.2.bb
@@ -2,7 +2,10 @@ SUMMARY = "raw image decoder"
2LICENSE = "LGPL-2.1-only | CDDL-1.0" 2LICENSE = "LGPL-2.1-only | CDDL-1.0"
3LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=1501ae0aa3c8544e63f08d6f7bf88a6f" 3LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=1501ae0aa3c8544e63f08d6f7bf88a6f"
4 4
5SRC_URI = "git://github.com/LibRaw/LibRaw.git;branch=0.21-stable;protocol=https" 5SRC_URI = " \
6 git://github.com/LibRaw/LibRaw.git;branch=0.21-stable;protocol=https \
7 file://0001-CVE-2025-43961-CVE-2025-43962.patch \
8"
6SRCREV = "1ef70158d7fde1ced6aaddb0b9443c32a7121d3d" 9SRCREV = "1ef70158d7fde1ced6aaddb0b9443c32a7121d3d"
7S = "${WORKDIR}/git" 10S = "${WORKDIR}/git"
8 11