jq: Fix CVE-2026-49839

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/jqlang/jq/commit/e987df0d463d85fd70825e042a082427e8275b86
[2] https://github.com/jqlang/jq/security/advisories/GHSA-cfh2-vwfq-qfmm

Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
Darsh Kelaiya
2026-07-21 02:39:37 -07:00
committed by Anuj Mittal
parent 624fedbfa0
commit 6d3530d6a1
2 changed files with 38 additions and 0 deletions
@@ -0,0 +1,37 @@
From 851544d2a13cf8baca1824196ac15cfe81d63224 Mon Sep 17 00:00:00 2001
From: itchyny <itchyny@cybozu.co.jp>
Date: Mon, 8 Jun 2026 22:14:48 +0900
Subject: [PATCH] Fix heap-buffer-overflow in raw file loading
When `jv_string_append_buf` overflows the string length limit,
it returns an invalid `jv`; `jv_load_file` then re-entered it
on the invalid value and overran the heap. Break out of the loop
once the value is invalid.
Fixes CVE-2026-49839.
CVE: CVE-2026-49839
Upstream-Status: Backport [https://github.com/jqlang/jq/commit/e987df0d463d85fd70825e042a082427e8275b86]
(cherry picked from commit e987df0d463d85fd70825e042a082427e8275b86)
Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
---
src/jv_file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/jv_file.c b/src/jv_file.c
index b10bcc0..40137c3 100644
--- a/src/jv_file.c
+++ b/src/jv_file.c
@@ -57,6 +57,8 @@ jv jv_load_file(const char* filename, int raw) {
if (raw) {
data = jv_string_append_buf(data, buf, n);
+ if (!jv_is_valid(data))
+ break;
} else {
jv_parser_set_buf(parser, buf, n, !feof(file));
jv value;
--
2.44.4
+1
View File
@@ -27,6 +27,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
file://CVE-2026-43896.patch \
file://CVE-2026-43895.patch \
file://CVE-2026-47770.patch \
file://CVE-2026-49839.patch \
"
SRC_URI[sha256sum] = "478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2"