Limit path depth to prevent stack overflow
Deeply nested path arrays can cause unbounded recursion in `jv_setpath`, `jv_getpath`, and `jv_delpaths`, leading to stack overflow. Add a depth limit of 10000 to match the existing `tojson` depth limit. This fixes CVE-2026-33947.
This commit is contained in:
1 parent
2f09060afa
commit
fb59f14910
2 files changed
+46
No files matched your search
@@ -2568,3 +2568,28 @@ true
|
||||
reduce range(10001) as $_ ([];[.]) | tojson | contains("<skipped: too deep>")
|
||||
null
|
||||
true
|
||||
|
||||
# regression test for CVE-2026-33947
|
||||
setpath([range(10000) | 0]; 0) | flatten
|
||||
null
|
||||
[0]
|
||||
|
||||
try setpath([range(10001) | 0]; 0) catch .
|
||||
null
|
||||
"Path too deep"
|
||||
|
||||
getpath([range(10000) | 0])
|
||||
null
|
||||
null
|
||||
|
||||
try getpath([range(10001) | 0]) catch .
|
||||
null
|
||||
"Path too deep"
|
||||
|
||||
delpaths([[range(10000) | 0]])
|
||||
null
|
||||
null
|
||||
|
||||
try delpaths([[range(10001) | 0]]) catch .
|
||||
null
|
||||
"Path too deep"
|
||||
Reference in new issue
Block a user