lix/src/libexpr
Tuomas Tynkkynen a0e38c16bc libexpr: Recognize newline in more places in lexer
Flex's regexes have an annoying feature: the dot matches everything
except a newline. This causes problems for expressions like:

"${0}\
"

where the backslash-newline combination matches this rule instead of the
intended one mentioned in the comment:

    <STRING>\$|\\|\$\\ {
                    /* This can only occur when we reach EOF, otherwise the above
                    (...|\$[^\{\"\\]|\\.|\$\\.)+ would have triggered.
                    This is technically invalid, but we leave the problem to the
                    parser who fails with exact location. */
                    return STR;
                }
However, the parser actually accepts the resulting token sequence
('"' DOLLAR_CURLY 0 '}' STR '"'), which is a problem because the lexer
rule didn't assign anything to yylval. Ultimately this leads to a crash
when dereferencing a NULL pointer in ExprConcatStrings::bindVars().

The fix does change the syntax of the language in some corner cases
but I think it's only turning previously invalid (or crashing) syntax
to valid syntax. E.g.

"a\
b"

and

''a''\
b''

were previously syntax errors but now both result in "a\nb".

Found by afl-fuzz.
2018-03-02 17:30:48 +02:00
..
primops fetchGit: use "HEAD" as default ref 2018-02-28 16:34:34 -06:00
attr-path.cc Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
attr-path.hh Work on Values instead of Exprs 2013-09-03 13:17:51 +00:00
attr-set.cc libexpr: Rely on Boehm returning zeroed memory in EvalState::allocEnv() 2018-02-17 16:54:21 +02:00
attr-set.hh libexpr: Don't create lots of temporary strings in Bindings::lexicographicOrder 2018-02-19 22:47:25 +02:00
common-eval-args.cc nix: Respect -I, --arg, --argstr 2017-10-24 12:58:34 +02:00
common-eval-args.hh Fix build 2017-11-01 21:32:30 +01:00
eval-inline.hh Restore thunks on any exception 2017-06-20 12:13:17 +02:00
eval.cc Actually fix nixDataDir in non-canonical path 2018-02-28 06:19:40 -05:00
eval.hh libexpr: Optimize prim_derivationStrict by using more symbol comparisons 2018-02-17 16:54:21 +02:00
get-drvs.cc nix-shell/nix-build: Support .drv files again 2017-11-24 18:08:35 +01:00
get-drvs.hh nix-shell/nix-build: Support .drv files again 2017-11-24 18:08:35 +01:00
json-to-value.cc json-to-value: Throw sensible error message on invalid numbers 2017-12-14 19:09:45 -05:00
json-to-value.hh Add builtin function ‘fromJSON’ 2014-07-04 13:34:15 +02:00
lexer.l libexpr: Recognize newline in more places in lexer 2018-03-02 17:30:48 +02:00
local.mk Shut up some warnings 2017-04-14 14:42:20 +02:00
names.cc Add splitVersion primop. 2018-02-14 09:55:43 -05:00
names.hh Add splitVersion primop. 2018-02-14 09:55:43 -05:00
nix-expr.pc.in Install some pkgconfig files 2014-09-18 12:00:40 +02:00
nixexpr.cc Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
nixexpr.hh Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
parser.y Remove git:// support in NIX_PATH 2017-11-03 13:55:31 +01:00
primops.cc Actually fix nixDataDir in non-canonical path 2018-02-28 06:19:40 -05:00
primops.hh Allow using RegisterPrimop to define constants. 2018-02-08 14:35:50 -05:00
symbol-table.hh Include config.h implicitly with '-include config.h' in CFLAGS 2017-02-08 21:51:02 +02:00
value-to-json.cc nix path-info: Add --json flag 2016-08-29 17:29:24 +02:00
value-to-json.hh nix path-info: Add --json flag 2016-08-29 17:29:24 +02:00
value-to-xml.cc First hit at providing support for floats in the language. 2016-01-05 00:40:40 +01:00
value-to-xml.hh Use "#pragma once" to prevent repeated header file inclusion 2012-07-18 14:59:03 -04:00
value.hh Restructure installables handling in the "nix" command 2017-04-25 11:20:37 +02:00