From 037d5454a39260635aeb7064ac32c7a485af8197 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 17 Nov 2021 10:27:03 +0000 Subject: crashtesting: crash on passing null to std::string_view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with many documents, e.g. moz377878-1.xhtml https: //gitlab.com/orcus/orcus/-/merge_requests/113 Change-Id: I085543ebb28c02a1c0ec487b357f6e0a83004363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125378 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- external/liborcus/UnpackedTarball_liborcus.mk | 4 ++++ ...crash-on-passing-null-to-std-string_vie.patch.1 | 27 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 external/liborcus/crashtesting-crash-on-passing-null-to-std-string_vie.patch.1 (limited to 'external') diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk index 3d2cec42e55e..86c30431e05d 100644 --- a/external/liborcus/UnpackedTarball_liborcus.mk +++ b/external/liborcus/UnpackedTarball_liborcus.mk @@ -15,6 +15,9 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,liborcus,1)) $(eval $(call gb_UnpackedTarball_update_autoconf_configs,liborcus)) +# crashtesting-crash-on-passing-null-to-std-string_vie.patch.1 submitted as +# https://gitlab.com/orcus/orcus/-/merge_requests/113 + $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ external/liborcus/rpath.patch.0 \ external/liborcus/gcc9.patch.0 \ @@ -25,6 +28,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ external/liborcus/unused-variables.patch.1 \ external/liborcus/boost-filesystem.patch.1 \ external/liborcus/std-get-busted.patch.1 \ + external/liborcus/crashtesting-crash-on-passing-null-to-std-string_vie.patch.1 \ )) ifeq ($(OS),WNT) diff --git a/external/liborcus/crashtesting-crash-on-passing-null-to-std-string_vie.patch.1 b/external/liborcus/crashtesting-crash-on-passing-null-to-std-string_vie.patch.1 new file mode 100644 index 000000000000..97e7b8366fde --- /dev/null +++ b/external/liborcus/crashtesting-crash-on-passing-null-to-std-string_vie.patch.1 @@ -0,0 +1,27 @@ +From ed21a93e132b968d8cd91aa080e1f90e980267c7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Wed, 17 Nov 2021 10:21:32 +0000 +Subject: [PATCH] crashtesting: crash on passing null to std::string_view + +with many documents, e.g. moz377878-1.xhtml +--- + src/parser/xml_namespace.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/parser/xml_namespace.cpp b/src/parser/xml_namespace.cpp +index 07942563..66077d9c 100644 +--- a/src/parser/xml_namespace.cpp ++++ b/src/parser/xml_namespace.cpp +@@ -223,7 +223,8 @@ xmlns_id_t xmlns_context::push(std::string_view key, std::string_view uri) + #endif + mp_impl->m_trim_all_ns = true; + +- std::string_view uri_interned = mp_impl->repo->intern(uri); ++ xmlns_id_t id = mp_impl->repo->intern(uri); ++ std::string_view uri_interned = id ? std::string_view(id) : std::string_view(); + + if (key.empty()) + { +-- +2.33.1 + -- cgit v1.2.3