Skip to content

Commit

Permalink
Fix integer overflow coverity issues in CPU plugin: 1548297, 1548502,…
Browse files Browse the repository at this point in the history
… 1548522
  • Loading branch information
aobolensk committed Jan 3, 2025
1 parent 548786a commit 4d4bb57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void AdaptivePooling::execute(dnnl::stream strm) {
auto dstStrides = getChildEdgeAt(0)->getMemory().getDescWithType<BlockedMemoryDesc>()->getStrides();

// unified strides array
const size_t tailDimsOffset = (isTailCFmt ? -1 : 0);
const ptrdiff_t tailDimsOffset = (isTailCFmt ? -1 : 0);
const size_t inStrides[5] = {srcStrides[0],
(isTailCFmt ? 1 : srcStrides[1]),
(spatialDimsCount == 3 ? srcStrides[2 + tailDimsOffset] : 0),
Expand Down
1 change: 1 addition & 0 deletions src/plugins/intel_cpu/src/nodes/batch_to_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void BatchToSpace::batchToSpaceKernel() {
size_t channels = (inShape5D[1] / blockSize);
channels = channels == 0 ? 1 : channels;
const size_t workAmount = inShape5D[0] * channels;
OPENVINO_ASSERT(workAmount > 0, "BatchToSpace layer has unsupported work amount == 0");

parallel_nt(0, [&](const int ithr, const int nthr) {
size_t start(0lu), end(0lu);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/intel_cpu/src/nodes/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ Subgraph::ControlFlowPasses Subgraph::getControlFlowPasses() const {

uint8_t Subgraph::getBroadcastingMask(const std::vector<VectorDims>& input_shapes) {
uint8_t mask = 0;
OPENVINO_ASSERT(broadcastable_inputs.size() <= sizeof(mask) * CHAR_BIT,
"Incorrect size of broadcastable inputs of Subgraph");
for (const auto& broadcastable_input : broadcastable_inputs) {
const auto& shape = input_shapes[broadcastable_input.first];
mask = mask << 1;
Expand Down

0 comments on commit 4d4bb57

Please sign in to comment.