[PATCH] D95112: X86: Fix use-after-realloc in X86AsmParser::ParseIntelExpression
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 21 11:24:50 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf2fd41d7897e: X86: Fix use-after-realloc in X86AsmParser::ParseIntelExpression (authored by dexonsmith).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95112/new/
https://reviews.llvm.org/D95112
Files:
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1842,12 +1842,15 @@
bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
MCAsmParser &Parser = getParser();
- const AsmToken &Tok = Parser.getTok();
StringRef ErrMsg;
AsmToken::TokenKind PrevTK = AsmToken::Error;
bool Done = false;
while (!Done) {
+ // Get a fresh reference on each loop iteration in case the previous
+ // iteration moved the token storage during UnLex().
+ const AsmToken &Tok = Parser.getTok();
+
bool UpdateLocLex = true;
AsmToken::TokenKind TK = getLexer().getKind();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95112.318263.patch
Type: text/x-patch
Size: 788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210121/63173b3a/attachment.bin>
More information about the llvm-commits
mailing list