mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 23:02:27 +00:00
77e9e1ed91
Otherwise, running e.g.
nix-instantiate --eval -E --strict 'builtins.replaceStrings [""] ["X"] "abc"'
would just hang in an infinite loop.
Found by afl-fuzz.
First attempt of this was reverted in e2d71bd186
because it caused
another infinite loop, which is fixed now and a test added.
12 lines
344 B
Nix
12 lines
344 B
Nix
with builtins;
|
|
|
|
[ (replaceStrings ["o"] ["a"] "foobar")
|
|
(replaceStrings ["o"] [""] "foobar")
|
|
(replaceStrings ["oo"] ["u"] "foobar")
|
|
(replaceStrings ["oo" "a"] ["a" "oo"] "foobar")
|
|
(replaceStrings ["oo" "oo"] ["u" "i"] "foobar")
|
|
(replaceStrings [""] ["X"] "abc")
|
|
(replaceStrings [""] ["X"] "")
|
|
(replaceStrings ["-"] ["_"] "a-b")
|
|
]
|