Skip to content

Conversation

Riyazul555
Copy link

As I was studying the issue #32110

This is my observation

  • In OpenVINO, the function get_ov_lib_path() returns a std::string.
  • When OPENVINO_ENABLE_UNICODE_PATH_SUPPORT is enabled on Windows, this string is encoded in UTF-8.
  • Later, this string was passed into path_join, which internally uses std::filesystem::path.
  • Problem: On Windows, std::filesystem::path interprets a std::string as locale encoding, not UTF-8.
    This mismatch caused crashes if the path contained non-ASCII characters (e.g., Korean 새 폴더3).

And the changes I proposed

  • Identified the unsafe usage
    Originally, the code constructed the path like this:
const auto ov_library_path = ov::util::get_ov_lib_path();
auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, xml_file_name}).string();
  • Introduced explicit conversion to std::filesystem::path
const auto ov_library_path_str = ov::util::get_ov_lib_path();

#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
    ov::util::Path ov_library_path = std::filesystem::u8path(ov_library_path_str);
#else
    ov::util::Path ov_library_path = std::filesystem::path(ov_library_path_str);
#endif

With Unicode support → u8path correctly interprets the UTF-8 string.
Without Unicode support → fallback to locale-based constructor (keeps legacy behavior).

  • Passed the path object instead of raw string
auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, xml_file_name}).string();

PLEASE REVIEW THIS PR AND DO LET ME KNOW IF THERE ARE ANY CHANGES REQUIRED

THANKS

@Riyazul555 Riyazul555 requested a review from a team as a code owner October 2, 2025 14:22
@github-actions github-actions bot added the category: inference OpenVINO Runtime library - Inference label Oct 2, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Oct 2, 2025
@mlukasze mlukasze requested a review from barnasm1 October 3, 2025 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: inference OpenVINO Runtime library - Inference ExternalPR External contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants