value flow: fixed crash reported in #5343 when typeStartToken and typeEndToken are misplaced.
This commit is contained in:
parent
eb774054b0
commit
c1c2f4bbc6
|
@ -188,8 +188,8 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, ErrorLogger *errorLog
|
||||||
const ValueFlow::Value val(tok, num);
|
const ValueFlow::Value val(tok, num);
|
||||||
ValueFlow::Value val2;
|
ValueFlow::Value val2;
|
||||||
if (num==1U && Token::Match(tok,"<=|>=")) {
|
if (num==1U && Token::Match(tok,"<=|>=")) {
|
||||||
bool isunsigned = var->typeEndToken()->isUnsigned();
|
bool isunsigned = false;
|
||||||
for (const Token* type = var->typeStartToken(); type != var->typeEndToken(); type = type->next())
|
for (const Token* type = var->typeStartToken(); type && type->varId() == 0U; type = type->next())
|
||||||
isunsigned |= type->isUnsigned();
|
isunsigned |= type->isUnsigned();
|
||||||
if (isunsigned)
|
if (isunsigned)
|
||||||
val2 = ValueFlow::Value(tok,0);
|
val2 = ValueFlow::Value(tok,0);
|
||||||
|
|
Loading…
Reference in New Issue