value flow: fixed crash reported in #5343 when typeStartToken and typeEndToken are misplaced.

This commit is contained in:
Daniel Marjamäki 2014-01-13 20:54:09 +01:00
parent eb774054b0
commit c1c2f4bbc6
1 changed files with 2 additions and 2 deletions

View File

@ -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);