Skip to content

Commit e79166a

Browse files
committed
Revert "Fix danmar#546 fuzzing crash in simplecpp::preprocess() (danmar#553)"
This reverts commit dcc0380.
1 parent 982c7ea commit e79166a

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

simplecpp.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,11 +3645,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
36453645
header = tok->str().substr(1U, tok->str().size() - 2U);
36463646
closingAngularBracket = true;
36473647
}
3648-
if (tok) {
3649-
std::ifstream f;
3650-
const std::string header2 = openHeader(f,dui,sourcefile,header,systemheader);
3651-
expr.push_back(new Token(header2.empty() ? "0" : "1", tok->location));
3652-
}
3648+
std::ifstream f;
3649+
const std::string header2 = openHeader(f,dui,sourcefile,header,systemheader);
3650+
expr.push_back(new Token(header2.empty() ? "0" : "1", tok->location));
36533651
}
36543652
if (par)
36553653
tok = tok ? tok->next : nullptr;

test.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3487,12 +3487,6 @@ static void fuzz_crash()
34873487
"foo(f##oo(intp))\n";
34883488
(void)preprocess(code, simplecpp::DUI()); // do not crash
34893489
}
3490-
{ // #546
3491-
const char code[] = "#if __has_include<\n";
3492-
simplecpp::OutputList outputList;
3493-
ASSERT_EQUALS("", preprocess(code, &outputList)); // do not crash
3494-
ASSERT_EQUALS("file0,1,syntax_error,failed to evaluate #if condition\n", toString(outputList));
3495-
}
34963490
}
34973491

34983492
// memory leaks detected by LSAN/valgrind

0 commit comments

Comments
 (0)