[PATCH] D135356: [Format] Fix crash when hitting eof while lexing JS template string
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 6 08:00:08 PDT 2022
sammccall marked an inline comment as done.
sammccall added inline comments.
================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:767
if (Offset[0] == '\\') {
++Offset; // Skip the escaped character.
} else if (Offset + 1 < Lex->getBuffer().end() && Offset[0] == '$' &&
----------------
kadircet wrote:
> it's a separate concern, but feels like this could also trigger some crashes (e.g. an input like "`\")
Good catch. I think you're right, but:
- I'm not sure
- that example doesn't crash under asan, and I didn't find a crashing one
- that pattern occurs a bunch more times in this file
- I really want to have an isolated minimal fix + test as this bug is causing an outage
- I don't really have spare time now to dive deeper into this
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135356/new/
https://reviews.llvm.org/D135356
More information about the cfe-commits
mailing list