Skip to content

Commit 4e462d0

Browse files
authored
[CPU] Fix Coverity remarks related to nullptr dereference and invalid iterator (#30423)
### Details: Fix Coverity remark 1542737 ### Tickets: - 165923
1 parent b809422 commit 4e462d0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,14 @@ CausalMaskPreprocess::CausalMaskPreprocess() {
226226
ov::intel_cpu::CausalMaskPreprocessNode::Config config;
227227
config.type = "CausalMaskPreprocess";
228228

229-
auto triu = ov::as_type_ptr<ov::opset1::Constant>(pattern_map.find(const_triu)->second.get_node_shared_ptr());
229+
auto const_triu_it = pattern_map.find(const_triu);
230+
if (const_triu_it == pattern_map.end()) {
231+
return false;
232+
}
233+
auto triu = ov::as_type_ptr<ov::opset1::Constant>(const_triu_it->second.get_node_shared_ptr());
234+
if (!triu) {
235+
return false;
236+
}
230237

231238
auto triu_shape = triu->get_output_shape(0);
232239
if (triu_shape.size() != 4) {

0 commit comments

Comments
 (0)