[PATCH] D94950: [clang][lex] Speculative fix for buffer overrun on raw string parse
Brent Royal-Gordon via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 23 14:05:41 PST 2021
brentdax added inline comments.
================
Comment at: clang/lib/Lex/LiteralSupport.cpp:1639
const char *Prefix = ThisTokBuf;
- while (ThisTokBuf[0] != '(')
+ while (ThisTokBuf - Prefix < 16 && ThisTokBuf[0] != '(')
++ThisTokBuf;
----------------
Nit: "16" is a magic number; it might be better to use a constant or comment to document its significance (raw strings can only have 16-character delimiters).
(I believe this is C++11 [lex.string]p2, but I've never written one of the citation comments you see in clang, so I'm not sure if you should cite a later standard.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94950/new/
https://reviews.llvm.org/D94950
More information about the cfe-commits
mailing list