summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorVijay Anusuri <vanusuri@mvista.com>2024-06-04 09:25:27 +0530
committerArmin Kuster <akuster808@gmail.com>2024-06-27 11:23:55 -0400
commitbbbe4d53206f8d545effaa2a1f1caaf9811f8daf (patch)
treecdedb8c8f35c15d315d8e1ceea4e4c46e8755b5e /meta-oe
parent9fd5ae9132c4d9f5a9b7a272be2ad24bd238f8b6 (diff)
downloadmeta-openembedded-bbbe4d53206f8d545effaa2a1f1caaf9811f8daf.tar.gz
yajl: backport Debian patch for CVE-2022-24795
import patch from ubuntu to fix CVE-2022-24795 Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/yajl/tree/debian/patches/?h=ubuntu%2Ffocal-security Upstream commit https://github.com/ppisar/yajl/commit/23cea2d7677e396efed78bbf1bf153961fab6bad] Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-devtools/yajl/yajl/CVE-2022-24795.patch61
-rw-r--r--meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb1
2 files changed, 62 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/yajl/yajl/CVE-2022-24795.patch b/meta-oe/recipes-devtools/yajl/yajl/CVE-2022-24795.patch
new file mode 100644
index 0000000000..4de46e699d
--- /dev/null
+++ b/meta-oe/recipes-devtools/yajl/yajl/CVE-2022-24795.patch
@@ -0,0 +1,61 @@
1From 23cea2d7677e396efed78bbf1bf153961fab6bad Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
3Date: Thu, 7 Apr 2022 17:29:54 +0200
4Subject: [PATCH] Fix CVE-2022-24795
5
6There was an integer overflow in yajl_buf_ensure_available() leading
7to allocating less memory than requested. Then data were written past
8the allocated heap buffer in yajl_buf_append(), the only caller of
9yajl_buf_ensure_available(). Another result of the overflow was an
10infinite loop without a return from yajl_buf_ensure_available().
11
12yajl-ruby project, which bundles yajl, fixed it
13<https://github.com/brianmario/yajl-ruby/pull/211> by checking for the
14integer overflow, fortifying buffer allocations, and report the
15failures to a caller. But then the caller yajl_buf_append() skips
16a memory write if yajl_buf_ensure_available() failed leading to a data
17corruption.
18
19A yajl fork mainter recommended calling memory allocation callbacks with
20the large memory request and let them to handle it. But that has the
21problem that it's not possible pass the overely large size to the
22callbacks.
23
24This patch catches the integer overflow and terminates the process
25with abort().
26
27https://github.com/lloyd/yajl/issues/239
28https://github.com/brianmario/yajl-ruby/security/advisories/GHSA-jj47-x69x-mxrm
29
30Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/yajl/tree/debian/patches/CVE-2022-24795.patch
31Upstream commit
32https://github.com/ppisar/yajl/commit/23cea2d7677e396efed78bbf1bf153961fab6bad]
33CVE: CVE-2022-24795
34Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
35---
36 src/yajl_buf.c | 12 +++++++++++-
37 1 file changed, 11 insertions(+), 1 deletion(-)
38
39diff --git a/src/yajl_buf.c b/src/yajl_buf.c
40index 1aeafde0..55c11add 100644
41--- a/src/yajl_buf.c
42+++ b/src/yajl_buf.c
43@@ -45,7 +45,17 @@ void yajl_buf_ensure_available(yajl_buf buf, size_t want)
44
45 need = buf->len;
46
47- while (want >= (need - buf->used)) need <<= 1;
48+ if (((buf->used > want) ? buf->used : want) > (size_t)(buf->used + want)) {
49+ /* We cannot allocate more memory than SIZE_MAX. */
50+ abort();
51+ }
52+ while (want >= (need - buf->used)) {
53+ if (need >= (size_t)((size_t)(-1)<<1)>>1) {
54+ /* need would overflow. */
55+ abort();
56+ }
57+ need <<= 1;
58+ }
59
60 if (need != buf->len) {
61 buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need);
diff --git a/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb b/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb
index 697f54d9fb..eca709cc17 100644
--- a/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb
+++ b/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb
@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=39af6eb42999852bdd3ea00ad120a36d"
10 10
11SRC_URI = "git://github.com/lloyd/yajl;branch=master;protocol=https \ 11SRC_URI = "git://github.com/lloyd/yajl;branch=master;protocol=https \
12 file://CVE-2023-33460.patch \ 12 file://CVE-2023-33460.patch \
13 file://CVE-2022-24795.patch \
13 " 14 "
14SRCREV = "a0ecdde0c042b9256170f2f8890dd9451a4240aa" 15SRCREV = "a0ecdde0c042b9256170f2f8890dd9451a4240aa"
15 16