mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 11:19:35 +01:00
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.
8 lines
286 B
Nix
8 lines
286 B
Nix
# Test that toJSON on a deeply nested structure produces a controlled
|
|
# stack overflow error rather than a segfault.
|
|
|
|
let
|
|
long = builtins.genList (x: x) 100000;
|
|
reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|
|
in
|
|
builtins.toJSON reverseLinkedList
|