diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-03-11 18:48:59 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-03-11 18:56:42 +0100 |
commit | 98f06f4e475bc1ec4969ae9e770426b045743f14 (patch) | |
tree | 9e98ea5fbea4bb25be2a61b7dfc0ce92aede507c /lexer.c | |
parent | a4785102dc58ce9c8facb716f18d3aaad0538cba (diff) |
lexer: properly handle string escape sequences at buffer boundary
While parsing string literals, actually consume the backslash introducing an
escape sequence to prevent it from ending up in the produced string if the
scanner is at the end of the buffer and the remaining buffer contents are
flushed after the consumer loop.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r-- | lexer.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -614,7 +614,7 @@ parse_string(uc_lexer *lex, bool no_regexp) else if (*ptr == '\\') { lex->is_escape = true; lookbehind_append(lex, lex->bufstart, ptr - lex->bufstart); - buf_consume(lex, ptr - lex->bufstart); + buf_consume(lex, (ptr - lex->bufstart) + 1); } } |