Skip to content

Commit e25c512

Browse files
Fix #12511 fuzzing crash (stack overflow) in getLibraryContainer() (#6165)
1 parent 91f1a25 commit e25c512

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

lib/valueflow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4972,6 +4972,8 @@ static void valueFlowLifetime(TokenList &tokenlist, ErrorLogger *errorLogger, co
49724972
}
49734973
// address of
49744974
else if (tok->isUnaryOp("&")) {
4975+
if (Token::simpleMatch(tok->astParent(), "*"))
4976+
continue;
49754977
for (const ValueFlow::LifetimeToken& lt : ValueFlow::getLifetimeTokens(tok->astOperand1())) {
49764978
if (!settings.certainty.isEnabled(Certainty::inconclusive) && lt.inconclusive)
49774979
continue;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d o(){t&a=*&a}

test/testvalueflow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7434,6 +7434,9 @@ class TestValueFlow : public TestFixture {
74347434
" if (*q > 0 && *q < 100) {}\n"
74357435
"}\n";
74367436
valueOfTok(code, "&&");
7437+
7438+
code = "void f() { int& a = *&a; }\n"; // #12511
7439+
valueOfTok(code, "=");
74377440
}
74387441

74397442
void valueFlowHang() {

0 commit comments

Comments
 (0)