[Libreoffice-commits] core.git: 2 commits - external/expat sd/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 22 05:20:01 UTC 2019


 external/expat/UnpackedTarball_expat.mk               |    1 +
 external/expat/ubsan.patch.0                          |   11 +++++++++++
 sd/source/ui/framework/factories/BasicPaneFactory.cxx |    2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit ad53c152cc1b79f9a64fffcff766e0fa29c3e287
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 21 22:57:46 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 22 07:19:30 2019 +0200

    external/expat: Avoid -fsanitizenullptr-with-offset
    
    ...(new with Clang 10 trunk), where adding even an offset of 0 to a null pointer
    is UB in C.  Seen when building CustomTarget_writerfilter/source:
    
    > [PY ] CustomTarget/writerfilter/source/ooxml/resourceids.hxx
    > workdir/UnpackedTarball/expat/lib/xmlparse.c:6488:23: runtime error: applying zero offset to null pointer
    >  #0 in hashTableIterInit at workdir/UnpackedTarball/expat/lib/xmlparse.c:6488:23
    >  #1 in dtdDestroy at workdir/UnpackedTarball/expat/lib/xmlparse.c:6130:3
    >  #2 in XML_ParserFree at workdir/UnpackedTarball/expat/lib/xmlparse.c:1368:5
    >  #3 in xmlparse_dealloc at workdir/UnpackedTarball/python3/Modules/pyexpat.c:1222:9
    >  #4 in insertdict at workdir/UnpackedTarball/python3/Objects/dictobject.c:807:9
    >  #5 in _PyObjectDict_SetItem at workdir/UnpackedTarball/python3/Objects/dictobject.c:3927:19
    >  #6 in _PyObject_GenericSetAttrWithDict at workdir/UnpackedTarball/python3/Objects/object.c:1159:19
    >  #7 in PyObject_SetAttr at workdir/UnpackedTarball/python3/Objects/object.c:930:15
    >  #8 in PyEval_EvalFrameEx at workdir/UnpackedTarball/python3/Python/ceval.c:2310:19
    [...]
    
    Change-Id: I152ddb20c726dbeb638c5fab4403423f5c6da7b5
    Reviewed-on: https://gerrit.libreoffice.org/81284
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/external/expat/UnpackedTarball_expat.mk b/external/expat/UnpackedTarball_expat.mk
index 5d4f41f6d147..96f4e3ec8732 100644
--- a/external/expat/UnpackedTarball_expat.mk
+++ b/external/expat/UnpackedTarball_expat.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,expat,conftools))
 
 $(eval $(call gb_UnpackedTarball_add_patches,expat,\
 	external/expat/expat-winapi.patch \
+	external/expat/ubsan.patch.0 \
 ))
 
 # This is a bit hackish.
diff --git a/external/expat/ubsan.patch.0 b/external/expat/ubsan.patch.0
new file mode 100644
index 000000000000..8317f922df88
--- /dev/null
+++ b/external/expat/ubsan.patch.0
@@ -0,0 +1,11 @@
+--- lib/xmlparse.c
++++ lib/xmlparse.c
+@@ -6485,7 +6485,7 @@
+ static void FASTCALL
+ hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) {
+   iter->p = table->v;
+-  iter->end = iter->p + table->size;
++  iter->end = table->size == 0 ? iter->p : iter->p + table->size;
+ }
+ 
+ static NAMED *FASTCALL
commit 0c3e90d95c2c952265625bcff590599627114ec1
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 21 22:16:42 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 22 07:19:17 2019 +0200

    Comparison between css::uno::WeakReference and css::uno::Reference
    
    ...causes overload resolution ambiguity in C++20, as observed with recent
    Clang 10 trunk with -std=c++2a:
    
    > sd/source/ui/framework/factories/BasicPaneFactory.cxx:327:39: error: use of overloaded operator '==' is ambiguous (with operand types 'css::uno::WeakReference<css::drawing::framework::XConfigurationController>' and 'const ::css::uno::Reference< ::css::uno::XInterface>')
    >     if (mxConfigurationControllerWeak == rEventObject.Source)
    >         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
    > include/com/sun/star/uno/Reference.hxx:425:28: note: candidate function (with reversed parameter order)
    > inline bool BaseReference::operator == ( const BaseReference & rRef ) const
    >                            ^
    > include/cppuhelper/weakref.hxx:106:19: note: candidate function
    >     bool SAL_CALL operator == ( const WeakReferenceHelper & rObj ) const
    
    An alternative would be to add overloads for combinations of
    css::uno::WeakReference adn css::uno::Reference, but this was the only case of
    such an ambiguity across the whole code base, such just resolve it with an
    explicit .get().
    
    Change-Id: I4689d5ffd4f8993cc1f9401d3c21b24f53f21ccd
    Reviewed-on: https://gerrit.libreoffice.org/81282
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index 2754b71d369f..e34b471f8b2a 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -324,7 +324,7 @@ void SAL_CALL BasicPaneFactory::notifyConfigurationChange (
 void SAL_CALL BasicPaneFactory::disposing (
     const lang::EventObject& rEventObject)
 {
-    if (mxConfigurationControllerWeak == rEventObject.Source)
+    if (mxConfigurationControllerWeak.get() == rEventObject.Source)
     {
         mxConfigurationControllerWeak.clear();
     }


More information about the Libreoffice-commits mailing list