Skip to content

Commit 9a22be4

Browse files
VKumbhar24akuster
authored andcommitted
openjpeg: Backport fix CVE-2021-3575
Upstream-Status: Backport from uclouvain/openjpeg@7bd884f Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
1 parent 1a3b9da commit 9a22be4

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 7bd884f8750892de4f50bf4642fcfbe7011c6bdf Mon Sep 17 00:00:00 2001
2+
From: Even Rouault <even.rouault@spatialys.com>
3+
Date: Sun, 18 Feb 2024 17:02:25 +0100
4+
Subject: [PATCH] opj_decompress: fix off-by-one read heap-buffer-overflow in
5+
sycc420_to_rgb() when x0 and y0 are odd (CVE-2021-3575, fixes #1347)
6+
7+
Upstream-Status: Backport [https://github.com/uclouvain/openjpeg/commit/7bd884f8750892de4f50bf4642fcfbe7011c6bdf]
8+
CVE: CVE-2021-3575
9+
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
10+
---
11+
src/bin/common/color.c | 12 ++++++++++--
12+
1 file changed, 10 insertions(+), 2 deletions(-)
13+
14+
diff --git a/src/bin/common/color.c b/src/bin/common/color.c
15+
index 27f15f13..ae5d648d 100644
16+
--- a/src/bin/common/color.c
17+
+++ b/src/bin/common/color.c
18+
@@ -358,7 +358,15 @@ static void sycc420_to_rgb(opj_image_t *img)
19+
if (i < loopmaxh) {
20+
size_t j;
21+
22+
- for (j = 0U; j < (maxw & ~(size_t)1U); j += 2U) {
23+
+ if (offx > 0U) {
24+
+ sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
25+
+ ++y;
26+
+ ++r;
27+
+ ++g;
28+
+ ++b;
29+
+ }
30+
+
31+
+ for (j = 0U; j < (loopmaxw & ~(size_t)1U); j += 2U) {
32+
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
33+
34+
++y;
35+
@@ -375,7 +383,7 @@ static void sycc420_to_rgb(opj_image_t *img)
36+
++cb;
37+
++cr;
38+
}
39+
- if (j < maxw) {
40+
+ if (j < loopmaxw) {
41+
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
42+
}
43+
}
44+
--
45+
2.39.3

meta-oe/recipes-graphics/openjpeg/openjpeg_2.4.0.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SRC_URI = " \
1111
file://0001-This-patch-fixed-include-dir-to-usr-include-.-Obviou.patch \
1212
file://CVE-2021-29338.patch \
1313
file://CVE-2022-1122.patch \
14+
file://CVE-2021-3575.patch \
1415
"
1516
SRCREV = "37ac30ceff6640bbab502388c5e0fa0bff23f505"
1617
S = "${WORKDIR}/git"

0 commit comments

Comments
 (0)