printAmbiguous (used by nix-instantiate --eval and nix-env) had a depth parameter, but all callers passed INT_MAX, effectively disabling the limit. The function relied on the C++ stack to eventually overflow, which could cause uncontrolled SIGSEGV crashes on deeply nested pre-forced structures. Now printAmbiguous checks depth against max-call-depth (default 10000) and throws StackOverflowError with a proper trace, consistent with other recursive value traversal functions. The function signature is updated to take EvalState& to access the settings and throw proper errors. The depth parameter now counts up from 0 instead of down from INT_MAX.
2.4 KiB
Executable File
2.4 KiB
Executable File