forked from OSchip/llvm-project
Don't overread the buffer when an %x escape in inline asm ends prematurely.
Tested by valgrind & Sema/asm.c. llvm-svn: 134404
This commit is contained in:
parent
de1d62314a
commit
e87c38b229
|
@ -366,6 +366,10 @@ unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces,
|
|||
// Handle %x4 and %x[foo] by capturing x as the modifier character.
|
||||
char Modifier = '\0';
|
||||
if (isalpha(EscapedChar)) {
|
||||
if (CurPtr == StrEnd) { // Premature end.
|
||||
DiagOffs = CurPtr-StrStart-1;
|
||||
return diag::err_asm_invalid_escape;
|
||||
}
|
||||
Modifier = EscapedChar;
|
||||
EscapedChar = *CurPtr++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue