Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
dd66ecb1cc
!126 fix CVE-2024-56827
Merge pull request !126 from changtao/openEuler-24.03-LTS
2025-01-09 07:34:46 +00:00
openeuler-ci-bot
331e9a8d58
!119 fix CVE-2024-56826
From: @zppzhangpan 
Reviewed-by: @weidongkl 
Signed-off-by: @weidongkl
2025-01-07 06:04:24 +00:00
zhangpan
0aa8067bb8 fix CVE-2024-56826 2025-01-07 01:45:54 +00:00
changtao
67e6d39ba7 fix CVE-2024-56827 2025-01-04 11:13:26 +08:00
openeuler-ci-bot
8224414333
!111 fix CVE-2021-3575
From: @zppzhangpan 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2024-10-31 09:23:36 +00:00
zhangpan
e1d155b0b2 fix CVE-2021-3575 2024-10-29 09:12:11 +00:00
openeuler-ci-bot
27dec7dfb4
!100 fix CVE-2023-39328
From: @xinghe_1 
Reviewed-by: @weidongkl 
Signed-off-by: @weidongkl
2024-07-11 07:58:24 +00:00
xh
5928ebc0ba fix CVE-2023-39328 2024-07-11 05:59:57 +00:00
openeuler-ci-bot
3096c56179
!94 移除构建目标目录包括的架构信息
From: @jiachao2130 
Reviewed-by: @open-bot 
Signed-off-by: @open-bot
2023-10-10 08:42:53 +00:00
Jia Chao
120b75b6a5 Fix: BuildDir does not care about architecture, remove arch flag to create the same help on all platform
Signed-off-by: Jia Chao <jiac13@chinaunicom.cn>
2023-05-29 16:47:11 +08:00
6 changed files with 258 additions and 29 deletions

View File

@ -0,0 +1,43 @@
From 7bd884f8750892de4f50bf4642fcfbe7011c6bdf Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Sun, 18 Feb 2024 17:02:25 +0100
Subject: [PATCH] opj_decompress: fix off-by-one read heap-buffer-overflow in
sycc420_to_rgb() when x0 and y0 are odd (CVE-2021-3575, fixes #1347)
Reference:https://github.com/uclouvain/openjpeg/commit/7bd884f8750892de4f50bf4642fcfbe7011c6bdf
Conflict:NA
---
src/bin/common/color.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/bin/common/color.c b/src/bin/common/color.c
index 27f15f137..ae5d648da 100644
--- a/src/bin/common/color.c
+++ b/src/bin/common/color.c
@@ -358,7 +358,15 @@ static void sycc420_to_rgb(opj_image_t *img)
if (i < loopmaxh) {
size_t j;
- for (j = 0U; j < (maxw & ~(size_t)1U); j += 2U) {
+ if (offx > 0U) {
+ sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
+ ++y;
+ ++r;
+ ++g;
+ ++b;
+ }
+
+ for (j = 0U; j < (loopmaxw & ~(size_t)1U); j += 2U) {
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y;
@@ -375,7 +383,7 @@ static void sycc420_to_rgb(opj_image_t *img)
++cb;
++cr;
}
- if (j < maxw) {
+ if (j < loopmaxw) {
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
}
}

View File

@ -0,0 +1,32 @@
From b287b27a87ecfbbd3b1206b17269d19e76a1b467 Mon Sep 17 00:00:00 2001
From: pic4xiu <40382944+pic4xiu@users.noreply.github.com>
Date: Thu, 29 Jun 2023 19:50:47 +0800
Subject: [PATCH] Update opj_malloc.c
Conflict: NA
Reference: https://github.com/uclouvain/openjpeg/commit/b287b27a87ecfbbd3b1206b17269d19e76a1b467
---
src/lib/openjp2/opj_malloc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/lib/openjp2/opj_malloc.c b/src/lib/openjp2/opj_malloc.c
index dca91bfcb..6242614f9 100644
--- a/src/lib/openjp2/opj_malloc.c
+++ b/src/lib/openjp2/opj_malloc.c
@@ -197,6 +197,16 @@ void * opj_malloc(size_t size)
}
void * opj_calloc(size_t num, size_t size)
{
+ static unsigned long long allocated_size = 0;
+ static unsigned long long max_allocated_size = 4ULL * 1024 * 1024 * 1024;
+ /*Restrict this function can only malloc 4GB of memory*/
+
+ unsigned long long total_size = (unsigned long long)(num * size);
+ allocated_size += total_size;
+ if (allocated_size > max_allocated_size) {
+ /*Prevent excessive resource allocation*/
+ return NULL;
+ }
if (num == 0 || size == 0) {
/* prevent implementation defined behavior of realloc */
return NULL;

View File

@ -0,0 +1,122 @@
From 98592ee6d6904f1b48e8207238779b89a63befa2 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Mon, 25 Nov 2024 23:11:24 +0100
Subject: [PATCH] sycc422_to_rgb(): fix out-of-bounds read accesses when 2 *
width_component_1_or_2 + 1 == with_component_0
Fixes #1563
Also adjusts sycc420_to_rgb() for potential similar issue (amending
commit 7bd884f8750892de4f50bf4642fcfbe7011c6bdf)
---
src/bin/common/color.c | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/src/bin/common/color.c b/src/bin/common/color.c
index ae5d648da..e4924a152 100644
--- a/src/bin/common/color.c
+++ b/src/bin/common/color.c
@@ -158,7 +158,7 @@ static void sycc422_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
- size_t maxw, maxh, max, offx, loopmaxw;
+ size_t maxw, maxh, max, offx, loopmaxw, comp12w;
int offset, upb;
size_t i;
@@ -167,6 +167,7 @@ static void sycc422_to_rgb(opj_image_t *img)
upb = (1 << upb) - 1;
maxw = (size_t)img->comps[0].w;
+ comp12w = (size_t)img->comps[1].w;
maxh = (size_t)img->comps[0].h;
max = maxw * maxh;
@@ -212,13 +213,19 @@ static void sycc422_to_rgb(opj_image_t *img)
++cr;
}
if (j < loopmaxw) {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
+ if (j / 2 == comp12w) {
+ sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
+ } else {
+ sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
+ }
++y;
++r;
++g;
++b;
- ++cb;
- ++cr;
+ if (j / 2 < comp12w) {
+ ++cb;
+ ++cr;
+ }
}
}
@@ -246,7 +253,7 @@ static void sycc420_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b, *nr, *ng, *nb;
const int *y, *cb, *cr, *ny;
- size_t maxw, maxh, max, offx, loopmaxw, offy, loopmaxh;
+ size_t maxw, maxh, max, offx, loopmaxw, offy, loopmaxh, comp12w;
int offset, upb;
size_t i;
@@ -255,6 +262,7 @@ static void sycc420_to_rgb(opj_image_t *img)
upb = (1 << upb) - 1;
maxw = (size_t)img->comps[0].w;
+ comp12w = (size_t)img->comps[1].w;
maxh = (size_t)img->comps[0].h;
max = maxw * maxh;
@@ -336,19 +344,29 @@ static void sycc420_to_rgb(opj_image_t *img)
++cr;
}
if (j < loopmaxw) {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
+ if (j / 2 == comp12w) {
+ sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
+ } else {
+ sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
+ }
++y;
++r;
++g;
++b;
- sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
+ if (j / 2 == comp12w) {
+ sycc_to_rgb(offset, upb, *ny, 0, 0, nr, ng, nb);
+ } else {
+ sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
+ }
++ny;
++nr;
++ng;
++nb;
- ++cb;
- ++cr;
+ if (j / 2 < comp12w) {
+ ++cb;
+ ++cr;
+ }
}
y += maxw;
r += maxw;
@@ -384,7 +402,11 @@ static void sycc420_to_rgb(opj_image_t *img)
++cr;
}
if (j < loopmaxw) {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
+ if (j / 2 == comp12w) {
+ sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
+ } else {
+ sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
+ }
}
}

View File

@ -0,0 +1,28 @@
From e492644fbded4c820ca55b5e50e598d346e850e8 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Mon, 25 Nov 2024 22:02:54 +0100
Subject: [PATCH] opj_j2k_add_tlmarker(): validate that current tile-part
number if smaller that total number of tile-parts
Fixes #1564
---
src/lib/openjp2/j2k.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index bcce316..dce786e 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -8362,7 +8362,8 @@ static OPJ_BOOL opj_j2k_add_tlmarker(OPJ_UINT32 tileno,
if (type == J2K_MS_SOT) {
OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno;
- if (cstr_index->tile_index[tileno].tp_index) {
+ if (cstr_index->tile_index[tileno].tp_index &&
+ l_current_tile_part < cstr_index->tile_index[tileno].nb_tps) {
cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos;
}
--
2.46.0

View File

@ -1,22 +0,0 @@
diff -rupN --no-dereference openjpeg-2.4.0/src/bin/common/color.c openjpeg-2.4.0-new/src/bin/common/color.c
--- openjpeg-2.4.0/src/bin/common/color.c 2020-12-28 21:59:39.000000000 +0100
+++ openjpeg-2.4.0-new/src/bin/common/color.c 2021-05-27 23:46:46.961130438 +0200
@@ -368,12 +368,15 @@ static void sycc420_to_rgb(opj_image_t *
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y;
+ if (*y != img->comps[0].data[loopmaxh])
+ ++y;
++r;
++g;
++b;
- ++cb;
- ++cr;
+ if (*cb != img->comps[1].data[loopmaxh])
+ ++cb;
+ if (*cr != img->comps[2].data[loopmaxh])
+ ++cr;
}
if (j < maxw) {
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);

View File

@ -1,13 +1,18 @@
%global BuildDir %{_vendor}-%{_target_os}%{?_gnu}
Name: openjpeg2
Version: 2.5.0
Release: 2
Release: 7
Summary: C-Library for JPEG 2000
License: BSD and MIT
URL: https://github.com/uclouvain/openjpeg
Source0: https://github.com/uclouvain/openjpeg/archive/v%{version}/openjpeg-%{version}.tar.gz
Patch0: openjpeg2_opj2.patch
Patch1: heap-buffer-overflow.patch
Patch1: backport-CVE-2023-39328.patch
Patch2: backport-CVE-2021-3575.patch
Patch3: backport-CVE-2024-56826.patch
Patch4: backport-CVE-2024-56827.patch
BuildRequires: cmake gcc-c++ make zlib-devel libpng-devel libtiff-devel lcms2-devel doxygen java-devel
BuildRequires: jbigkit-devel libjpeg-turbo-devel
@ -47,8 +52,8 @@ Command line tools for JPEG 2000 file manipulation, using OpenJPEG2:
find thirdparty/ -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
%build
mkdir %{_target_platform}
pushd %{_target_platform}
mkdir %{BuildDir}
pushd %{BuildDir}
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENJPEG_INSTALL_LIB_DIR=%{_lib} \
%{?optional_components:-DBUILD_MJ2=ON -DBUILD_JPWL=ON -DBUILD_JPIP=ON -DBUILD_JP3D=ON} \
-DBUILD_DOC=ON \
@ -58,11 +63,11 @@ pushd %{_target_platform}
..
popd
%make_build VERBOSE=1 -C %{_target_platform}
%make_build VERBOSE=1 -C %{BuildDir}
%install
%make_install -C %{_target_platform}
%make_install -C %{BuildDir}
mv %{buildroot}%{_mandir}/man1/opj_compress.1 %{buildroot}%{_mandir}/man1/opj2_compress.1
mv %{buildroot}%{_mandir}/man1/opj_decompress.1 %{buildroot}%{_mandir}/man1/opj2_decompress.1
@ -87,7 +92,7 @@ mv %{buildroot}%{_mandir}/man1/opj_dump.1 %{buildroot}%{_mandir}/man1/opj2_dump.
%files help
%defattr(-,root,root)
%doc %{_target_platform}/doc/html
%doc %{BuildDir}/doc/html
%doc NEWS.md README.md THANKS.md
%{_mandir}/man1/*.1*
%{_mandir}/man3/*.3*
@ -98,6 +103,27 @@ mv %{buildroot}%{_mandir}/man1/opj_dump.1 %{buildroot}%{_mandir}/man1/opj2_dump.
%{_bindir}/opj2_dump
%changelog
* Tue Jan 7 2025 changtao <changtao@kylinos.cn> - 2.5.0-7
- Type: CVE
- CVE: CVE-2024-56827
- SUG: NA
- DESC: fix CVE-2024-56827
* Tue Jan 7 2025 zhangpan <zhangpan103@h-partners.com> - 2.5.0-6
- fix CVE-2024-56826
* Tue Oct 29 2024 zhangpan <zhangpan103@h-partners.com> - 2.5.0-5
- fix CVE-2021-3575
* Thu Jul 11 2024 xinghe <xinghe2@h-partners.com> - 2.5.0-4
- Type:cves
- ID:CVE-2023-39328
- SUG:NA
- DESC:fix CVE-2023-39328
* Mon May 29 2023 Jia Chao <jiachao2130@126.com> - 2.5.0-3
- Fix: builddir contains arch info make help create different noarch pkg.
* Tue Feb 28 2023 zhangpan <zhangpan103@h-partners.com> - 2.5.0-2
- Remove useless buildrequires