Skip to content

Commit f3ad9cc

Browse files
MayureshV1Copilot
andauthored
Update onnxruntime/core/providers/openvino/backend_utils.cc
Co-authored-by: Copilot <[email protected]>
1 parent 21506c6 commit f3ad9cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

onnxruntime/core/providers/openvino/backend_utils.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ bool IsModelStreamXML(std::istream& model_stream) {
413413
// Choose 32 bytes to hold content of:
414414
// '<?xml version-"1.0"?> <net '
415415
const std::streamsize header_check_len = 32;
416-
ORT_ENFORCE(total_size > header_check_len);
416+
if (total_size < header_check_len) {
417+
// Restore the stream position before returning
418+
model_stream.seekg(originalPos);
419+
return false;
420+
}
417421

418422
// read 32 bytes into header
419423
std::string header(header_check_len, '\0');

0 commit comments

Comments
 (0)