Skip to content

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

[CORE] The vector returned by ov::util::load_binary() has a size of 0. (#33882)

Sungeun Kimf6221c2f44e9
diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp
index f941b7f7b5e..891c20f57f3 100644
--- a/src/common/util/src/file_util.cpp
+++ b/src/common/util/src/file_util.cpp
@@ -250,8 +250,8 @@ std::filesystem::path ov::util::get_plugin_path(const std::filesystem::path& plu
std::vector<uint8_t> ov::util::load_binary(const std::filesystem::path& path) {
std::vector<uint8_t> buffer;
if (auto input = std::ifstream(path, std::ios::binary); input.is_open()) {
- buffer.reserve(std::filesystem::file_size(path));
- input.read(reinterpret_cast<char*>(buffer.data()), buffer.capacity());
+ buffer.resize(std::filesystem::file_size(path));
+ input.read(reinterpret_cast<char*>(buffer.data()), buffer.size());
}
return buffer;
}