diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-08-15 15:28:40 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-08-15 16:36:04 +0200 |
commit | ffdc97898b145c9b0cebd22f0393da2c27e17a47 (patch) | |
tree | a4ac84f6b7c84c2aa868f89d0dff2fd0d54a55f7 /external | |
parent | LLVM trunk requires C++14 now (diff) | |
download | core-ffdc97898b145c9b0cebd22f0393da2c27e17a47.tar.gz core-ffdc97898b145c9b0cebd22f0393da2c27e17a47.zip |
Fix linking of newly created element in liborcus 0.15.0
After 56ffe3c0a1261cd98a3d42b8b08d5f8eb013ead4 "Switch mdds to 1.5.0 and
liborcus to 0.15.0", CppunitTest_sc_dataprovider started to fail in ASan builds
with
> ERROR: AddressSanitizer: new-delete-type-mismatch on 0x6060005b9340 in thread T4 (XML Fetch Threa):
> object passed to delete has wrong type:
> size of the allocated type: 56 bytes;
> size of the deallocated type: 16 bytes.
> #0 in operator delete(void*, unsigned long) at llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
> #1 in orcus::xml_map_tree::element::~element() at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:238:13
[...]
> #25 in std::unique_ptr<orcus::orcus_xml::impl, std::default_delete<orcus::orcus_xml::impl> >::~unique_ptr()
> #26 in orcus::orcus_xml::~orcus_xml() at workdir/UnpackedTarball/liborcus/src/liborcus/orcus_xml.cpp:530:26
> #27 in ScOrcusXMLContextImpl::importXML(ScOrcusImportXMLParam const&) at sc/source/filter/orcus/xmlcontext.cxx:286:5
[...]
> 0x6060005b9340 is located 0 bytes inside of 56-byte region [0x6060005b9340,0x6060005b9378)
> allocated by thread T4 (XML Fetch Threa) here:
> #0 in operator new(unsigned long) at llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
> #1 in orcus::xml_map_tree::element::element(char const*, orcus::pstring const&, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type) at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:203:26
> #2 in std::unique_ptr<orcus::xml_map_tree::element, std::default_delete<orcus::xml_map_tree::element> > orcus::make_unique<orcus::xml_map_tree::element, char const*&, orcus::pstring, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type>(char const*&, orcus::pstring&&, orcus::xml_map_tree::element_type&&, orcus::xml_map_tree::reference_type&&) at workdir/UnpackedTarball/liborcus/src/liborcus/../../include/orcus/global.hpp:61:35
> #3 in orcus::xml_map_tree::element::get_or_create_child(orcus::string_pool&, char const*, orcus::pstring const&) at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:271:9
> #4 in orcus::xml_map_tree::get_linked_node(orcus::pstring const&, orcus::xml_map_tree::reference_type) at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:722:31
[...]
Change-Id: Iad8e06ead6f2655a3e26ceeab368e9b50028402f
Reviewed-on: https://gerrit.libreoffice.org/77519
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/liborcus/UnpackedTarball_liborcus.mk | 1 | ||||
-rw-r--r-- | external/liborcus/create-element.patch.0 | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk index 74fbbb2e9e33..88e0963c6dde 100644 --- a/external/liborcus/UnpackedTarball_liborcus.mk +++ b/external/liborcus/UnpackedTarball_liborcus.mk @@ -22,6 +22,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ external/liborcus/rpath.patch.0 \ external/liborcus/gcc9.patch.0 \ external/liborcus/libtool.patch.0 \ + external/liborcus/create-element.patch.0 \ )) ifeq ($(OS),WNT) diff --git a/external/liborcus/create-element.patch.0 b/external/liborcus/create-element.patch.0 new file mode 100644 index 000000000000..b1012e5c90d8 --- /dev/null +++ b/external/liborcus/create-element.patch.0 @@ -0,0 +1,55 @@ +--- src/liborcus/xml_map_tree.cpp ++++ src/liborcus/xml_map_tree.cpp +@@ -723,35 +723,28 @@ + element* elem = r.first; + bool created = r.second; + +- if (created) +- { +- // No element of that name exists. +- elem->elem_type = element_linked; +- elem->ref_type = ref_type; +- } +- else ++ if (!created) + { + // This element already exists. Check if this is already linked. + if (elem->ref_type != reference_unknown || elem->elem_type != element_unlinked) + throw xpath_error("This element is already linked. You can't link the same element twice."); +- +- // Turn this existing non-linked element into a linked one. +- delete elem->child_elements; +- elem->elem_type = element_linked; +- elem->ref_type = ref_type; +- switch (ref_type) +- { +- case reference_cell: +- elem->cell_ref = new cell_reference; +- break; +- case reference_range_field: +- elem->field_ref = new field_in_range; +- break; +- default: +- throw general_error("Unknown reference type in xml_map_tree::get_element_stack."); +- } +- + } ++ ++ // Turn this existing non-linked element into a linked one. ++ delete elem->child_elements; ++ elem->elem_type = element_linked; ++ elem->ref_type = ref_type; ++ switch (ref_type) ++ { ++ case reference_cell: ++ elem->cell_ref = new cell_reference; ++ break; ++ case reference_range_field: ++ elem->field_ref = new field_in_range; ++ break; ++ default: ++ throw general_error("Unknown reference type in xml_map_tree::get_element_stack."); ++ } + + ret.elem_stack.push_back(elem); + ret.node = elem; |