diff --git a/src/native/monodroid/embedded-assemblies-zip.cc b/src/native/monodroid/embedded-assemblies-zip.cc index 0926b72c83c..f8d4811df7b 100644 --- a/src/native/monodroid/embedded-assemblies-zip.cc +++ b/src/native/monodroid/embedded-assemblies-zip.cc @@ -46,7 +46,6 @@ EmbeddedAssemblies::zip_load_entry_common (size_t entry_index, std::vector (apk_lib_dir_name, zip_path_separator, SharedConstants::android_lib_abi, zip_path_separator); - static constexpr std::string_view assemblies_prefix { assemblies_prefix_array }; + + // .data() must be used otherwise string_view length will include the trailing \0 in the array + static constexpr std::string_view assemblies_prefix { assemblies_prefix_array.data () }; // We have two records for each assembly, for names with and without the extension static constexpr uint32_t assembly_store_index_entries_per_assembly = 2; @@ -104,11 +106,14 @@ namespace xamarin::android::internal { static constexpr size_t assembly_store_file_name_size = calc_size (assembly_store_prefix, SharedConstants::android_lib_abi, assembly_store_extension, dso_suffix); static constexpr auto assembly_store_file_name_array = concat_string_views (assembly_store_prefix, SharedConstants::android_lib_abi, assembly_store_extension, dso_suffix); - static constexpr std::string_view assembly_store_file_name { assembly_store_file_name_array }; + + // .data() must be used otherwise string_view length will include the trailing \0 in the array + static constexpr std::string_view assembly_store_file_name { assembly_store_file_name_array.data () }; static constexpr size_t assembly_store_file_path_size = calc_size(apk_lib_dir_name, zip_path_separator, SharedConstants::android_lib_abi, zip_path_separator, assembly_store_prefix, SharedConstants::android_lib_abi, assembly_store_extension, dso_suffix); static constexpr auto assembly_store_file_path_array = concat_string_views (apk_lib_dir_name, zip_path_separator, SharedConstants::android_lib_abi, zip_path_separator, assembly_store_prefix, SharedConstants::android_lib_abi, assembly_store_extension, dso_suffix); - static constexpr std::string_view assembly_store_file_path { assembly_store_file_path_array }; + // .data() must be used otherwise string_view length will include the trailing \0 in the array + static constexpr std::string_view assembly_store_file_path { assembly_store_file_path_array.data () }; static constexpr size_t dso_size_overhead = ArchiveDSOStubConfig::PayloadSectionOffset + (ArchiveDSOStubConfig::SectionHeaderEntryCount * ArchiveDSOStubConfig::SectionHeaderEntrySize);