diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-10-11 09:43:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-10-12 14:50:36 +0200 |
commit | fa98d2da9219a03fb1fb0f213a8bdddf5040fe60 (patch) | |
tree | 4d9c2977891cba6b567054d8153195459aaddbae /include | |
parent | 5dd9990a12509ec9326c061544b228652e495fe5 (diff) |
Revert "Use placement new to avoid one of the allocation calls..."
This reverts commit 503ab1ca9ae11978d9717557546c01ff598aaf88, plus follow-up
17915ab5202a4d7456e9bc031c3f6a72bc861844 "fix ubsan alloc-dealloc-mismatch".
It failed to properly destroy the object assembly, and caused e.g.
CppunitTest_svl_items to fail with
> ==850754==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x6060000024e0 in thread T0:
> object passed to delete has wrong type:
> size of the allocated type: 64 bytes;
> size of the deallocated type: 56 bytes.
> #0 in operator delete(void*, unsigned long) at /home/sbergman/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3 (workdir/LinkTarget/Executable/cppunittester +0x330ae2)
> #1 in SfxItemSet::~SfxItemSet() at svl/source/items/itemset.cxx:202:1 (instdir/program/libsvllo.so +0x110ccf6)
> #2 in std::default_delete<SfxItemSet>::operator()(SfxItemSet*) const at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/unique_ptr.h:85:2 (instdir/program/libsvllo.so +0x1142a28)
> #3 in std::_Sp_counted_deleter<SfxItemSet*, std::default_delete<SfxItemSet>, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:442:9 (instdir/program/libsvllo.so +0x12696e4)
> #4 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:168:6 (instdir/program/libsvllo.so +0xe500b5)
[...]
> 0x6060000024e0 is located 0 bytes inside of 64-byte region [0x6060000024e0,0x606000002520)
> allocated by thread T0 here:
> #0 in operator new(unsigned long) at /home/sbergman/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3 (workdir/LinkTarget/Executable/cppunittester +0x32fe7d)
> #1 in SfxItemSet::Clone(bool, SfxItemPool*) const at svl/source/items/itemset.cxx:1270:34 (instdir/program/libsvllo.so +0x1127854)
> #2 in (anonymous namespace)::Node::setItemSet(SfxItemSet const&) at svl/source/items/stylepool.cxx:65:107 (instdir/program/libsvllo.so +0x1212179)
> #3 in StylePoolImpl::insertItemSet(SfxItemSet const&, rtl::OUString const*) at svl/source/items/stylepool.cxx:417:19 (instdir/program/libsvllo.so +0x12103e1)
> #4 in StylePool::insertItemSet(SfxItemSet const&, rtl::OUString const*) at svl/source/items/stylepool.cxx:456:17 (instdir/program/libsvllo.so +0x1212ffb)
[...]
in Clang ASan builds done with -fsized-deallocation.
Change-Id: I3ccba7e7d9712ecabf38a0149252d3cd70cdb446
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123446
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svl/itemset.hxx | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 5f9da72e3339..5ce13bb1f4c8 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -70,8 +70,6 @@ protected: SfxItemSet( SfxItemPool&, SfxAllItemSetFlag ); /** special constructor for SfxItemSetFixed */ SfxItemSet( SfxItemPool&, WhichRangesContainer&& ranges, SfxPoolItem const ** ppItems ); - /** special constructor for Clone */ - SfxItemSet( const SfxItemSet&, SfxPoolItem const ** ppItems ); public: SfxItemSet( const SfxItemSet& ); |