Avoid value truncation

This commit is contained in:
Dmitry-Me 2015-03-25 10:39:09 +03:00
parent be4e51f00b
commit 9398fa810b
1 changed files with 1 additions and 1 deletions

View File

@ -1736,7 +1736,7 @@ Check::FileInfo* CheckBufferOverrun::getFileInfo(const Tokenizer *tokenizer, con
tok->next()->astOperand2()) { tok->next()->astOperand2()) {
const ValueFlow::Value *value = tok->next()->astOperand2()->getMaxValue(false); const ValueFlow::Value *value = tok->next()->astOperand2()->getMaxValue(false);
if (value && value->intvalue > 0) { if (value && value->intvalue > 0) {
const int arrayIndex = value->intvalue; const MathLib::bigint arrayIndex = value->intvalue;
std::map<std::string, struct MyFileInfo::ArrayUsage>::iterator it = fileInfo->arrayUsage.find(tok->str()); std::map<std::string, struct MyFileInfo::ArrayUsage>::iterator it = fileInfo->arrayUsage.find(tok->str());
if (it != fileInfo->arrayUsage.end() && it->second.index >= arrayIndex) if (it != fileInfo->arrayUsage.end() && it->second.index >= arrayIndex)
continue; continue;