Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[Coverity Enterprise][Core] Execute unauthorized code (#30503)

barnasm1517ce55b941f
diff --git a/src/core/src/op/util/weightless_caching_attributes.cpp b/src/core/src/op/util/weightless_caching_attributes.cpp
index f3f61fe5689..4e595e47522 100644
--- a/src/core/src/op/util/weightless_caching_attributes.cpp
+++ b/src/core/src/op/util/weightless_caching_attributes.cpp
@@ -19,11 +19,14 @@ OPENVINO_API void ov::copy_weightless_cache_attr(const std::shared_ptr<ov::Node>
if (weightless_caching_attr != rt_info.end()) {
to->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] = weightless_caching_attr->second;
} else if (ov::is_type<ov::op::v0::Convert>(from) && ov::is_type<ov::op::v0::Constant>(to)) {
- auto convert_node = ov::as_type_ptr<ov::op::v0::Convert>(from);
- auto const_node = convert_node->get_input_node_ptr(0);
- weightless_caching_attr = const_node->get_rt_info().find(ov::WeightlessCacheAttribute::get_type_info_static());
- if (weightless_caching_attr != const_node->get_rt_info().end()) {
- to->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] = weightless_caching_attr->second;
+ if (auto convert_node = ov::as_type_ptr<ov::op::v0::Convert>(from); convert_node) {
+ auto const_node = convert_node->get_input_node_ptr(0);
+ weightless_caching_attr =
+ const_node->get_rt_info().find(ov::WeightlessCacheAttribute::get_type_info_static());
+ if (weightless_caching_attr != const_node->get_rt_info().end()) {
+ to->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] =
+ weightless_caching_attr->second;
+ }
}
}
-}
\ No newline at end of file
+}