MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isOutOfBounds

Method isOutOfBounds

lib/valueflow.cpp:7559–7570  ·  view source on GitHub ↗

TODO: return single value at most - no need for std::vector

Source from the content-addressed store, hash-verified

7557
7558// TODO: return single value at most - no need for std::vector
7559std::vector<ValueFlow::Value> ValueFlow::isOutOfBounds(const Value& size, const Token* indexTok, bool possible)
7560{
7561 ValueFlow::Value inBoundsValue = inferCondition("<", indexTok, size.intvalue);
7562 if (inBoundsValue.isKnown() && inBoundsValue.intvalue != 0)
7563 return {};
7564 std::vector<ValueFlow::Value> result = isOutOfBoundsImpl(size, indexTok, false);
7565 if (!result.empty())
7566 return result;
7567 if (!possible)
7568 return result;
7569 return isOutOfBoundsImpl(size, indexTok, true);
7570}

Callers

nothing calls this directly

Calls 4

inferConditionFunction · 0.85
isOutOfBoundsImplFunction · 0.85
isKnownMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected