mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 11:19:35 +01:00
libexpr: fix stack overflow in toJSON on deeply nested structures
Similar to the deepSeq fix, toJSON on deeply nested structures caused an uncontrolled OS-level stack overflow. Fix by adding call depth tracking to printValueAsJSON.
This commit is contained in:
parent
a812b6c6e6
commit
c7e1c612eb
5 changed files with 109 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
error:
|
||||
… while calling the 'toJSON' builtin
|
||||
at /pwd/lang/eval-fail-toJSON-stack-overflow.nix:8:1:
|
||||
7| in
|
||||
8| builtins.toJSON reverseLinkedList
|
||||
| ^
|
||||
9|
|
||||
|
||||
… while evaluating attribute 'tail'
|
||||
at /pwd/lang/eval-fail-toJSON-stack-overflow.nix:6:67:
|
||||
5| long = builtins.genList (x: x) 100000;
|
||||
6| reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|
||||
| ^
|
||||
7| in
|
||||
|
||||
(9997 duplicate frames omitted)
|
||||
|
||||
… while evaluating attribute 'head'
|
||||
at /pwd/lang/eval-fail-toJSON-stack-overflow.nix:6:62:
|
||||
5| long = builtins.genList (x: x) 100000;
|
||||
6| reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|
||||
| ^
|
||||
7| in
|
||||
|
||||
error: stack overflow; max-call-depth exceeded
|
||||
at /pwd/lang/eval-fail-toJSON-stack-overflow.nix:6:62:
|
||||
5| long = builtins.genList (x: x) 100000;
|
||||
6| reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|
||||
| ^
|
||||
7| in
|
||||
Loading…
Add table
Add a link
Reference in a new issue