File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
src/common/util/include/openvino/util Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ namespace util {
4848// / reads, bypassing the OS page cache pressure that mmap+memcpy incurs.
4949// /
5050// / For reads >= threshold bytes, the read is split across N threads where each
51- // / thread issues its own positional read (pread on Linux, OVERLAPPED ReadFile on
52- // / Windows) . Smaller reads fall through to a single positional call.
51+ // / thread issues its own independent positional read operation using
52+ // / platform-specific APIs . Smaller reads fall through to a single positional call.
5353// /
5454// / Usage:
5555// / @code
@@ -101,6 +101,22 @@ class ParallelReadStreamBuf : public std::streambuf {
101101 }
102102 m_file_size = static_cast <std::streamoff>(st.st_size );
103103#endif
104+
105+ if (m_file_offset < static_cast <std::streamoff>(0 ) || m_file_offset > m_file_size) {
106+ #ifdef _WIN32
107+ if (m_handle != INVALID_HANDLE_VALUE) {
108+ CloseHandle (m_handle);
109+ m_handle = INVALID_HANDLE_VALUE;
110+ }
111+ #else
112+ if (m_fd != -1 ) {
113+ ::close (m_fd);
114+ m_fd = -1 ;
115+ }
116+ #endif
117+ throw std::out_of_range (" ParallelReadStreamBuf: header_offset is out of range for file: " +
118+ path.string ());
119+ }
104120 }
105121
106122 ~ParallelReadStreamBuf () override {
You can’t perform that action at this time.
0 commit comments