summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-10-09 20:09:50 +0200
committerAnuj Mittal <anuj.mittal@intel.com>2025-10-30 14:43:30 +0800
commit7c893fb155b8f0c48adc17500fc8d53224836496 (patch)
tree7d184cc92e84f62b11c2e2f6ce745807a78df3a7 /meta-oe/recipes-graphics
parenta2a174aafc706cb565a287da884201ee8c8d9fcf (diff)
downloadmeta-openembedded-7c893fb155b8f0c48adc17500fc8d53224836496.tar.gz
jasper: patch CVE-2025-8835
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-8835 Pick the patch from the details of the above link. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'meta-oe/recipes-graphics')
-rw-r--r--meta-oe/recipes-graphics/jasper/jasper/0001-Fixes-400.patch171
-rw-r--r--meta-oe/recipes-graphics/jasper/jasper_4.1.1.bb4
2 files changed, 174 insertions, 1 deletions
diff --git a/meta-oe/recipes-graphics/jasper/jasper/0001-Fixes-400.patch b/meta-oe/recipes-graphics/jasper/jasper/0001-Fixes-400.patch
new file mode 100644
index 0000000000..217eb29179
--- /dev/null
+++ b/meta-oe/recipes-graphics/jasper/jasper/0001-Fixes-400.patch
@@ -0,0 +1,171 @@
1From ad08c18022f730937ccf9e9feb2a5236146afec5 Mon Sep 17 00:00:00 2001
2From: Michael Adams <mdadams@ece.uvic.ca>
3Date: Tue, 29 Jul 2025 20:16:35 -0700
4Subject: [PATCH] Fixes #400.
5
6Added a check for a missing color component in the jas_image_chclrspc
7function.
8
9CVE: CVE-2025-8835
10Upstream-Status: Backport [https://github.com/jasper-software/jasper/commit/bb7d62bd0a2a8e0e1fdb4d603f3305f955158c52]
11Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
12---
13 src/libjasper/base/jas_image.c | 72 ++++++++++++++++++++++++++++------
14 1 file changed, 61 insertions(+), 11 deletions(-)
15
16diff --git a/src/libjasper/base/jas_image.c b/src/libjasper/base/jas_image.c
17index 1ed0905..c8aa42b 100644
18--- a/src/libjasper/base/jas_image.c
19+++ b/src/libjasper/base/jas_image.c
20@@ -118,6 +118,8 @@ static void jas_image_calcbbox2(const jas_image_t *image,
21 jas_image_coord_t *bry);
22 static void jas_image_fmtinfo_init(jas_image_fmtinfo_t *fmtinfo);
23 static void jas_image_fmtinfo_cleanup(jas_image_fmtinfo_t *fmtinfo);
24+static jas_cmcmptfmt_t* jas_cmcmptfmt_array_create(int n);
25+static void jas_cmcmptfmt_array_destroy(jas_cmcmptfmt_t* cmptfmts, int n);
26
27 /******************************************************************************\
28 * Create and destroy operations.
29@@ -413,6 +415,36 @@ static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt)
30 jas_free(cmpt);
31 }
32
33+static jas_cmcmptfmt_t* jas_cmcmptfmt_array_create(int n)
34+{
35+ jas_cmcmptfmt_t* cmptfmts;
36+ JAS_LOGDEBUGF(10, "jas_cmcmptfmt_array_create(%d)\n", n);
37+ if (!(cmptfmts = jas_alloc2(n, sizeof(jas_cmcmptfmt_t)))) {
38+ return 0;
39+ }
40+ for (int i = 0; i < n; ++i) {
41+ cmptfmts[i].buf = 0;
42+ }
43+ JAS_LOGDEBUGF(10, "jas_cmcmptfmt_array_create(%d) returning %p\n", n,
44+ JAS_CAST(void *, cmptfmts));
45+ return cmptfmts;
46+}
47+
48+static void jas_cmcmptfmt_array_destroy(jas_cmcmptfmt_t* cmptfmts, int n)
49+{
50+ assert(cmptfmts);
51+ assert(n > 0);
52+ JAS_LOGDEBUGF(10, "jas_cmcmptfmt_array_destroy(%p, %d)\n",
53+ JAS_CAST(void *, cmptfmts), n);
54+ for (int i = 0; i < n; ++i) {
55+ if (cmptfmts[i].buf) {
56+ jas_free(cmptfmts[i].buf);
57+ }
58+ cmptfmts[i].buf = 0;
59+ }
60+ jas_free(cmptfmts);
61+}
62+
63 /******************************************************************************\
64 * Load and save operations.
65 \******************************************************************************/
66@@ -1588,12 +1620,15 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
67 jas_cmcmptfmt_t *incmptfmts;
68 jas_cmcmptfmt_t *outcmptfmts;
69
70+ assert(image);
71+ assert(outprof);
72+
73 #if 0
74 jas_eprintf("IMAGE\n");
75 jas_image_dump(image, stderr);
76 #endif
77
78- if (image->numcmpts_ == 0) {
79+ if (!jas_image_numcmpts(image)) {
80 /*
81 can't work with a file with no components;
82 continuing would crash because we'd attempt to
83@@ -1604,6 +1639,8 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
84
85 outimage = 0;
86 xform = 0;
87+ incmptfmts = 0;
88+ outcmptfmts = 0;
89 if (!(inimage = jas_image_copy(image))) {
90 goto error;
91 }
92@@ -1694,16 +1731,22 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
93 }
94
95 inpixmap.numcmpts = numinclrchans;
96- if (!(incmptfmts = jas_alloc2(numinclrchans, sizeof(jas_cmcmptfmt_t)))) {
97+ assert(numinclrchans != 0);
98+ if (!(incmptfmts = jas_cmcmptfmt_array_create(numinclrchans))) {
99 // formerly call to abort()
100 goto error;
101 }
102 inpixmap.cmptfmts = incmptfmts;
103 for (unsigned i = 0; i < numinclrchans; ++i) {
104 const int j = jas_image_getcmptbytype(inimage, JAS_IMAGE_CT_COLOR(i));
105+ if (j < 0) {
106+ jas_logerrorf("missing color component %d\n", i);
107+ goto error;
108+ }
109 if (!(incmptfmts[i].buf = jas_alloc2(width, sizeof(long)))) {
110 goto error;
111 }
112+ assert(j >= 0 && j < jas_image_numcmpts(inimage));
113 incmptfmts[i].prec = jas_image_cmptprec(inimage, j);
114 incmptfmts[i].sgnd = jas_image_cmptsgnd(inimage, j);
115 incmptfmts[i].width = width;
116@@ -1711,7 +1754,7 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
117 }
118
119 outpixmap.numcmpts = numoutclrchans;
120- if (!(outcmptfmts = jas_alloc2(numoutclrchans, sizeof(jas_cmcmptfmt_t)))) {
121+ if (!(outcmptfmts = jas_cmcmptfmt_array_create(numoutclrchans))) {
122 // formerly call to abort()
123 goto error;
124 }
125@@ -1719,9 +1762,14 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
126
127 for (unsigned i = 0; i < numoutclrchans; ++i) {
128 const int j = jas_image_getcmptbytype(outimage, JAS_IMAGE_CT_COLOR(i));
129+ if (j < 0) {
130+ jas_logerrorf("missing color component %d\n", i);
131+ goto error;
132+ }
133 if (!(outcmptfmts[i].buf = jas_alloc2(width, sizeof(long)))) {
134 goto error;
135 }
136+ assert(j >= 0 && j < jas_image_numcmpts(outimage));
137 outcmptfmts[i].prec = jas_image_cmptprec(outimage, j);
138 outcmptfmts[i].sgnd = jas_image_cmptsgnd(outimage, j);
139 outcmptfmts[i].width = width;
140@@ -1746,14 +1794,8 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
141 }
142 }
143
144- for (unsigned i = 0; i < numoutclrchans; ++i) {
145- jas_free(outcmptfmts[i].buf);
146- }
147- jas_free(outcmptfmts);
148- for (unsigned i = 0; i < numinclrchans; ++i) {
149- jas_free(incmptfmts[i].buf);
150- }
151- jas_free(incmptfmts);
152+ jas_cmcmptfmt_array_destroy(outcmptfmts, numoutclrchans);
153+ jas_cmcmptfmt_array_destroy(incmptfmts, numinclrchans);
154 jas_cmxform_destroy(xform);
155 jas_image_destroy(inimage);
156
157@@ -1765,6 +1807,14 @@ jas_image_t *jas_image_chclrspc(jas_image_t *image,
158 #endif
159 return outimage;
160 error:
161+ if (incmptfmts) {
162+ assert(numinclrchans);
163+ jas_cmcmptfmt_array_destroy(incmptfmts, numinclrchans);
164+ }
165+ if (outcmptfmts) {
166+ assert(numoutclrchans);
167+ jas_cmcmptfmt_array_destroy(outcmptfmts, numoutclrchans);
168+ }
169 if (xform) {
170 jas_cmxform_destroy(xform);
171 }
diff --git a/meta-oe/recipes-graphics/jasper/jasper_4.1.1.bb b/meta-oe/recipes-graphics/jasper/jasper_4.1.1.bb
index 5281980ecb..82867c0a1e 100644
--- a/meta-oe/recipes-graphics/jasper/jasper_4.1.1.bb
+++ b/meta-oe/recipes-graphics/jasper/jasper_4.1.1.bb
@@ -3,7 +3,9 @@ HOMEPAGE = "https://jasper-software.github.io/jasper/"
3LICENSE = "MIT" 3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=a80440d1d8f17d041c71c7271d6e06eb" 4LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=a80440d1d8f17d041c71c7271d6e06eb"
5 5
6SRC_URI = "git://github.com/jasper-software/jasper.git;protocol=https;branch=master" 6SRC_URI = "git://github.com/jasper-software/jasper.git;protocol=https;branch=master \
7 file://0001-Fixes-400.patch \
8 "
7SRCREV = "917f7708b755d8434f70618108c1a76f1b6a0a82" 9SRCREV = "917f7708b755d8434f70618108c1a76f1b6a0a82"
8 10
9CVE_STATUS[CVE-2015-8751] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions." 11CVE_STATUS[CVE-2015-8751] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."