1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-22 10:19:36 +01:00
nix/src/libexpr
Sergei Zimmerman 34f06900aa
libexpr: Fix invalid handling of errors for imported functions
c39cc00404 has added assertions for
all Value accesses and the following case has started failing with
an `unreachable`:

(/tmp/fun.nix):

```nix
{a}: a
```

```
$ nix eval --impure --expr 'import /tmp/fun.nix {a="a";b="b";}'
```

This would crash:

```
terminating due to unexpected unrecoverable internal error: Unexpected condition in getStorage at ../include/nix/expr/value.hh:844
```

This is not a regression, but rather surfaces an existing problem, which previously
was left undiagnosed. In the case of an import `fun` is the `import` primOp, so that read is invalid
and previously this resulted in an access into an inactive union member, which is UB.
The correct thing to use is `vCur`. Identical problem also affected the case of a missing argument.

Add previously failing test cases to the functional/lang test suite.

Fixes #13448.

(cherry picked from commit 6e78cc90d3)
2025-07-11 22:47:36 +03:00
..
include/nix/expr Fix some clang-tidy warnings 2025-04-07 20:38:07 +00:00
primops lockFlake(): Allow registry lookups for the top-level flake 2025-04-25 13:31:24 +02:00
value Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
.version Meson build for libexpr and libflake 2024-07-02 09:23:24 -04:00
attr-path.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
attr-set.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
eval-cache.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
eval-error.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
eval-gc.cc Add -Wundef to make #if FOO an error if not defined 2025-04-05 13:44:58 +02:00
eval-settings.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
eval.cc libexpr: Fix invalid handling of errors for imported functions 2025-07-11 22:47:36 +03:00
fetchurl.nix Format .nix files 2025-01-24 17:04:02 +01:00
function-trace.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
get-drvs.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
imported-drv-to-derivation.nix Format .nix files 2025-01-24 17:04:02 +01:00
json-to-value.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
lexer-helpers.cc Make lexer-helpers.hh internal to fix a clang-tidy error 2025-04-07 18:29:08 +00:00
lexer-helpers.hh Make lexer-helpers.hh internal to fix a clang-tidy error 2025-04-07 18:29:08 +00:00
lexer.l Make lexer-helpers.hh internal to fix a clang-tidy error 2025-04-07 18:29:08 +00:00
meson.build Clean some header related things. 2025-04-07 00:10:37 +00:00
meson.options Meson build for libexpr and libflake 2024-07-02 09:23:24 -04:00
nix-meson-build-support rename: build-utils-meson -> nix-meson-build-support 2024-12-09 16:54:42 +01:00
nixexpr.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
package.nix Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
parser.y Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
paths.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
primops.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
print-ambiguous.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
print.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
search-path.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
value-to-json.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00
value-to-xml.cc Expose the nix component in header include paths 2025-04-02 11:37:17 -04:00