Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential integer overflow coverity scan issue in CPU plugin subgraph implementation #28292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aobolensk
Copy link
Contributor

Details:

  • Fix "Overflowed return value" coverity scan issue: 1566368

Tickets:

@aobolensk aobolensk requested review from a team as code owners January 7, 2025 08:46
@github-actions github-actions bot added the category: CPU OpenVINO CPU plugin label Jan 7, 2025
@@ -962,7 +962,10 @@ Subgraph::SubgraphExecutor::SubgraphExecutor(const std::shared_ptr<Subgraph::Sub
m_in_requested_descs.end(),
size_t(0),
[](size_t sum, const std::pair<size_t, ov::intel_cpu::MemoryDescPtr>& requested_desc_elem) {
return sum + requested_desc_elem.second->getCurrentMemSize();
auto curr_mem_size = requested_desc_elem.second->getCurrentMemSize();
OPENVINO_ASSERT(curr_mem_size != ov::intel_cpu::MemoryDesc::UNDEFINED_SIZE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really prevent possible overflow?
If we really want to throw in case of overflow, the check should look like:

OPENVINO_ASSERT(sum < sum + curr_mem_size);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter concern was specifically about this UNDEFINED_SIZE value, which is basically (size_t)-1. This case is checked here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CPU OpenVINO CPU plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants