Skip to content

Commit 7a40fbc

Browse files
Fix #13493 fuzzing crash (stack overflow) in CheckNullPointer::nullPointerByDeRefAndCheck() (danmar#7160)
1 parent 5bbde51 commit 7a40fbc

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

lib/tokenize.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8765,6 +8765,8 @@ void Tokenizer::findGarbageCode() const
87658765
}
87668766
if (Token::Match(tok, "[{,] . %name%") && !Token::Match(tok->tokAt(3), "[.=[{]"))
87678767
syntaxError(tok->next());
8768+
if (Token::Match(tok, "%name% %op% %name%") && !tok->isKeyword() && tok->next()->isIncDecOp())
8769+
syntaxError(tok->next());
87688770
if (Token::Match(tok, "[!|+-/%^~] )|]"))
87698771
syntaxError(tok);
87708772
if (Token::Match(tok, "==|!=|<=|>= %comp%") && tok->strAt(-1) != "operator")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
n(){o?5:t++m}

test/testother.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5111,7 +5111,7 @@ class TestOther : public TestFixture {
51115111
" {\n"
51125112
" case 2:\n"
51135113
" y |= z;\n"
5114-
" z++\n"
5114+
" z++;\n"
51155115
" default:\n"
51165116
" y |= z;\n"
51175117
" break;\n"

test/teststl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ class TestStl : public TestFixture {
13861386
" std::vector<int>::const_iterator it;\n"
13871387
" it = a.begin();\n"
13881388
" while (it!=a.end())\n"
1389-
" v++it;\n"
1389+
" ++it;\n"
13901390
" it = t.begin();\n"
13911391
" while (it!=t.end())\n"
13921392
" ++it;\n"
@@ -1402,9 +1402,9 @@ class TestStl : public TestFixture {
14021402
" else\n"
14031403
" it = t.begin();\n"
14041404
" while (z && it!=a.end())\n"
1405-
" v++it;\n"
1405+
" ++it;\n"
14061406
" while (!z && it!=t.end())\n"
1407-
" v++it;\n"
1407+
" ++it;\n"
14081408
"}");
14091409
ASSERT_EQUALS("", errout_str());
14101410
}

0 commit comments

Comments
 (0)