Skip to content

Commit f0815b0

Browse files
[AUTO-CHERRYPICK] jasper: Add patch to resolve CVE-2023-51257 - branch main (#10340)
Co-authored-by: Sumynwa <sumsharma@microsoft.com>
1 parent 7f3b3ae commit f0815b0

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

SPECS/jasper/CVE-2023-51257.patch

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Date: Thu, 14 Dec 2023 19:04:19 -0800
2+
Subject: [PATCH] Fixes #367.
3+
4+
Fixed an integer-overflow bug in the ICC profile parsing code.
5+
Added another invalid image to the test set.
6+
---
7+
src/libjasper/base/jas_icc.c | 10 ++++++++++
8+
1 file changed, 10 insertions(+)
9+
10+
diff --git a/src/libjasper/base/jas_icc.c b/src/libjasper/base/jas_icc.c
11+
index 0a34587..2b26b5d 100644
12+
--- a/src/libjasper/base/jas_icc.c
13+
+++ b/src/libjasper/base/jas_icc.c
14+
@@ -1293,10 +1293,20 @@ static int jas_icctxt_input(jas_iccattrval_t *attrval, jas_stream_t *in,
15+
{
16+
jas_icctxt_t *txt = &attrval->data.txt;
17+
txt->string = 0;
18+
+ /* The string must at least contain a single null character. */
19+
+ if (cnt < 1) {
20+
+ goto error;
21+
+ }
22+
if (!(txt->string = jas_malloc(cnt)))
23+
goto error;
24+
if (jas_stream_read(in, txt->string, cnt) != cnt)
25+
goto error;
26+
+ /* Ensure that the string is null terminated. */
27+
+ if (txt->string[cnt - 1] != '\0') {
28+
+ goto error;
29+
+ }
30+
+ /* The following line is redundant, unless we do not enforce that
31+
+ the last character must be null. */
32+
txt->string[cnt - 1] = '\0';
33+
if (strlen(txt->string) + 1 != cnt)
34+
goto error;
35+
--
36+
2.25.1
37+

SPECS/jasper/jasper.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Implementation of the JPEG-2000 standard, Part 1
22
Name: jasper
33
Version: 2.0.32
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
License: JasPer
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -12,6 +12,7 @@ Patch2: jasper-2.0.14-rpath.patch
1212
# architecture related patches
1313
Patch100: jasper-2.0.2-test-ppc64-disable.patch
1414
Patch101: jasper-2.0.2-test-ppc64le-disable.patch
15+
Patch102: CVE-2023-51257.patch
1516
# autoreconf
1617
BuildRequires: cmake
1718
BuildRequires: gcc
@@ -73,6 +74,8 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
7374
%patch101 -p1 -b .test-ppc64le-disable
7475
%endif
7576

77+
%patch102 -p1 -b .cve-2023-51257.patch
78+
7679
%build
7780
mkdir builder
7881
%cmake \
@@ -113,6 +116,9 @@ make test -C builder
113116
%{_libdir}/libjasper.so.4*
114117

115118
%changelog
119+
* Fri Aug 23 2024 Sumedh Sharma <sumsharma@microsoft.com> - 2.0.32-4
120+
- Add patch to resolve CVE-2023-51257
121+
116122
* Wed Sep 20 2023 Jon Slobodzian <joslobo@microsoft.com> - 2.0.32-3
117123
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)
118124

0 commit comments

Comments
 (0)