mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
libexpr: Make unsafeGetAttrPos not crash on noPos
Currently e.g. `builtins.unsafeGetAttrPos "abort" builtins` will eventually segfault because pos->file is an unset Symbol. Found by afl-fuzz.
This commit is contained in:
parent
3fbaa230a2
commit
af86132e1a
3 changed files with 3 additions and 1 deletions
|
@ -628,7 +628,7 @@ void EvalState::mkThunk_(Value & v, Expr * expr)
|
|||
|
||||
void EvalState::mkPos(Value & v, Pos * pos)
|
||||
{
|
||||
if (pos) {
|
||||
if (pos && pos->file.set()) {
|
||||
mkAttrs(v, 3);
|
||||
mkString(*allocAttr(v, sFile), pos->file);
|
||||
mkInt(*allocAttr(v, sLine), pos->line);
|
||||
|
|
1
tests/lang/eval-okay-getattrpos-undefined.exp
Normal file
1
tests/lang/eval-okay-getattrpos-undefined.exp
Normal file
|
@ -0,0 +1 @@
|
|||
null
|
1
tests/lang/eval-okay-getattrpos-undefined.nix
Normal file
1
tests/lang/eval-okay-getattrpos-undefined.nix
Normal file
|
@ -0,0 +1 @@
|
|||
builtins.unsafeGetAttrPos "abort" builtins
|
Loading…
Reference in a new issue