Fixed #6361 (crash: CheckBufferOverrun)

This commit is contained in:
Daniel Marjamäki 2014-12-28 10:05:08 +01:00
parent 9ee1b80539
commit 208761f0c3
1 changed files with 1 additions and 1 deletions

View File

@ -889,7 +889,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
if (var && var->isArray()) { if (var && var->isArray()) {
const Token *index = tok->astParent()->astOperand2(); const Token *index = tok->astParent()->astOperand2();
const ValueFlow::Value *value = index ? index->getValueGE(1,_settings) : nullptr; const ValueFlow::Value *value = index ? index->getValueGE(1,_settings) : nullptr;
if (!value) if (index && !value)
value = index->getValueLE(-1 - arrayInfo.num(0), _settings); value = index->getValueLE(-1 - arrayInfo.num(0), _settings);
if (value) if (value)
pointerOutOfBoundsError(tok->astParent(), index, value->intvalue); pointerOutOfBoundsError(tok->astParent(), index, value->intvalue);