colis-anr / morbig

A static parser for POSIX Shell
Other
192 stars 8 forks source link

Problem with nestings in prelexer (triggering assertion failure and refusal of valid scripts) #78

Closed Niols closed 5 years ago

Niols commented 5 years ago

When given the script:

ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
                   < $libtoolize`"
ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}

Morbig fails with:

Fatal error: exception File "src/prelexerState.ml", line 331, characters 18-24: Assertion failed

Interestingly, when removing the last line and giving only:

ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
                   < $libtoolize`"

Morbig still fails but with:

Line 3, character 0: Lexical error (Unterminated nesting!).
yurug commented 5 years ago

Fixed by 86831401deb47343925391ecac5689273f4c4a37