Fix crash on expanding command line strings
This commit is contained in:
parent
0a2807e652
commit
7ba4ef897b
|
@ -168,6 +168,7 @@ void skip_blanks_and_comments(Reader& reader)
|
|||
|
||||
Token parse_percent_token(Reader& reader, bool throw_on_unterminated)
|
||||
{
|
||||
kak_assert(*reader == '%');
|
||||
++reader;
|
||||
const auto type_start = reader.pos;
|
||||
while (reader and iswalpha(*reader))
|
||||
|
@ -340,7 +341,9 @@ String expand_impl(StringView str, const Context& context,
|
|||
Codepoint c = *reader;
|
||||
if (c == '\\')
|
||||
{
|
||||
c = *++reader;
|
||||
if (not (++reader))
|
||||
throw parse_error{"unterminated escape"};
|
||||
c = *reader;
|
||||
if (c == '%' or c == '\\')
|
||||
{
|
||||
res += reader.substr_from(beg);
|
||||
|
|
1
test/regression/0-crash-on-specialy-crafted-modeline/cmd
Normal file
1
test/regression/0-crash-on-specialy-crafted-modeline/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
test/regression/0-crash-on-specialy-crafted-modeline/in
Normal file
1
test/regression/0-crash-on-specialy-crafted-modeline/in
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
test/regression/0-crash-on-specialy-crafted-modeline/out
Normal file
1
test/regression/0-crash-on-specialy-crafted-modeline/out
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
test/regression/0-crash-on-specialy-crafted-modeline/rc
Normal file
1
test/regression/0-crash-on-specialy-crafted-modeline/rc
Normal file
|
@ -0,0 +1 @@
|
|||
set global modelinefmt %{\}
|
Loading…
Reference in New Issue
Block a user