mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-08-25 17:32:06 +00:00
jq: fix infinite loop in CVE-2026-47770 backport
The backport dropped the "j++" body of the delpaths_sorted() grouping loop while adding the "== 1" guard, turning "while (...) j++;" into an empty-bodied "while (...);". The index never advances, so any update that produces "empty" (which reaches _modify() -> delpaths()) hangs, e.g. "map_values(. // empty)" and ".a |= empty". This also hangs the jq ptest suite. Restore the "j++" body while keeping the "== 1" guard. Assisted-by: kiro:claude-opus-4.8 Signed-off-by: Tugrul Kukul <tugrul.kukul@est.tech> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
committed by
Anuj Mittal
parent
af8b6d6b2f
commit
cd1dc3ec50
@@ -13,6 +13,7 @@ Fixes CVE-2026-47770.
|
||||
|
||||
Signed-off-by: Anton Skorup <antonsk@axis.com>
|
||||
Upstream-Status: Backport [https://github.com/jqlang/jq/commit/7122866869960b55cea3646bc91334ef55787831]
|
||||
Signed-off-by: Tugrul Kukul <tugrul.kukul@est.tech>
|
||||
---
|
||||
src/builtin.c | 36 +++++++++++++++--
|
||||
src/jv.c | 46 +++++++++++++++++-----
|
||||
@@ -237,13 +238,14 @@ index 594a21f..a39f1f1 100644
|
||||
static jv parse_slice(jv j, jv slice, int* pstart, int* pend) {
|
||||
// Array slices
|
||||
jv start_jv = jv_object_get(jv_copy(slice), jv_string("start"));
|
||||
@@ -471,8 +489,7 @@ static jv delpaths_sorted(jv object, jv paths, int start) {
|
||||
@@ -471,8 +489,8 @@ static jv delpaths_sorted(jv object, jv paths, int start) {
|
||||
int delkey = jv_array_length(jv_array_get(jv_copy(paths), i)) == start + 1;
|
||||
jv key = jv_array_get(jv_array_get(jv_copy(paths), i), start);
|
||||
while (j < jv_array_length(jv_copy(paths)) &&
|
||||
- jv_equal(jv_copy(key), jv_array_get(jv_array_get(jv_copy(paths), j), start)))
|
||||
- j++;
|
||||
+ jv_equal(jv_copy(key), jv_array_get(jv_array_get(jv_copy(paths), j), start)) == 1);
|
||||
+ jv_equal(jv_copy(key), jv_array_get(jv_array_get(jv_copy(paths), j), start)) == 1)
|
||||
+ j++;
|
||||
// if i <= entry < j, then entry starts with key
|
||||
if (delkey) {
|
||||
// deleting this entire key, we don't care about any more specific deletions
|
||||
|
||||
Reference in New Issue
Block a user