diff --git a/onnxruntime/core/flatbuffers/flatbuffers_utils.cc b/onnxruntime/core/flatbuffers/flatbuffers_utils.cc index 06b5a7cceb9f2..1eb3bbdb1237f 100644 --- a/onnxruntime/core/flatbuffers/flatbuffers_utils.cc +++ b/onnxruntime/core/flatbuffers/flatbuffers_utils.cc @@ -163,8 +163,9 @@ Status SaveValueInfoOrtFormat(flatbuffers::FlatBufferBuilder& builder, #endif // #if !defined(ORT_MINIMAL_BUILD) void LoadStringFromOrtFormat(std::string& dst, const flatbuffers::String* fbs_string) { - if (fbs_string) - dst = fbs_string->c_str(); + if (fbs_string) { + dst = fbs_string->str(); + } } static Status LoadTypeInfoOrtFormat(const fbs::TypeInfo& fbs_type_info, diff --git a/onnxruntime/core/flatbuffers/flatbuffers_utils.h b/onnxruntime/core/flatbuffers/flatbuffers_utils.h index 76860d6ab1db8..aed0c201a2dd5 100644 --- a/onnxruntime/core/flatbuffers/flatbuffers_utils.h +++ b/onnxruntime/core/flatbuffers/flatbuffers_utils.h @@ -40,7 +40,7 @@ void LoadStringFromOrtFormat(std::string& dst, const flatbuffers::String* fbs_st #define LOAD_STR_FROM_ORT_FORMAT(protobuf_msg, str_field, fbs_string) \ { \ if (fbs_string) \ - protobuf_msg.set_##str_field(fbs_string->c_str()); \ + protobuf_msg.set_##str_field(fbs_string->str()); \ } onnxruntime::common::Status LoadValueInfoOrtFormat(