| 3338 | } |
| 3339 | |
| 3340 | static const ValueFlow::Value* getOOBIterValue(const Token* tok, const ValueFlow::Value* sizeVal) |
| 3341 | { |
| 3342 | auto it = std::find_if(tok->values().begin(), tok->values().end(), [&](const ValueFlow::Value& v) { |
| 3343 | if (v.isPossible() || v.isKnown()) { |
| 3344 | switch (v.valueType) { |
| 3345 | case ValueFlow::Value::ValueType::ITERATOR_END: |
| 3346 | return v.intvalue >= 0; |
| 3347 | case ValueFlow::Value::ValueType::ITERATOR_START: |
| 3348 | return (v.intvalue < 0) || (sizeVal && v.intvalue >= sizeVal->intvalue); |
| 3349 | default: |
| 3350 | break; |
| 3351 | } |
| 3352 | } |
| 3353 | return false; |
| 3354 | }); |
| 3355 | return it != tok->values().end() ? &*it : nullptr; |
| 3356 | } |
| 3357 | |
| 3358 | void CheckStlImpl::eraseIteratorOutOfBounds() |
| 3359 | { |
no test coverage detected