Skip to content

Commit fa7ae1a

Browse files
committed
Fixed segfault when checking libusbx (daca2)
1 parent 6da9cca commit fa7ae1a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎lib/checkbufferoverrun.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,8 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
11861186
// Negative index..
11871187
for (const Token *tok2 = tok->next(); tok2 && tok2->str() == "["; tok2 = tok2->link()->next()) {
11881188
const Token *index = tok2->astOperand2();
1189+
if (!index)
1190+
continue;
11891191
std::list<ValueFlow::Value>::const_iterator it;
11901192
const ValueFlow::Value *val = nullptr;
11911193
for (it = index->values.begin(); it != index->values.end(); ++it) {

0 commit comments

Comments
 (0)