Skip to content
Snippets Groups Projects
Commit de6b5ce2 authored by Alexey Bataev's avatar Alexey Bataev
Browse files

Fix possible OOB access found by buildbot

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260219 91177308-0d34-0410-b5e6-96231b3b80d8
parent c75a1570
Branches
No related tags found
No related merge requests found
......@@ -573,19 +573,20 @@ struct UnknownPragmaHandler : public PragmaHandler {
Token &PragmaTok) override {
// Figure out what line we went to and insert the appropriate number of
// newline characters.
Callbacks->startNewLineIfNeeded();
Callbacks->MoveToLine(PragmaTok.getLocation());
Callbacks->OS.write(Prefix, strlen(Prefix));
if (ShouldExpandTokens) {
// The first token does not have expanded macros. Expand them, if
// required.
Token Toks[] = {PragmaTok};
PP.EnterTokenStream(Toks, llvm::array_lengthof(Toks),
Token *Toks = new Token[1];
Toks[0] = PragmaTok;
PP.EnterTokenStream(Toks, /*NumToks=*/1,
/*DisableMacroExpansion=*/false,
/*OwnsTokens=*/false);
/*OwnsTokens=*/true);
PP.Lex(PragmaTok);
}
Callbacks->startNewLineIfNeeded();
Callbacks->MoveToLine(PragmaTok.getLocation());
Callbacks->OS.write(Prefix, strlen(Prefix));
Token PrevToken;
Token PrevPrevToken;
PrevToken.startToken();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment