-fsanitize=undefined, and some fishy commits

Stephan Bergmann sbergman at redhat.com
Thu Mar 5 02:58:06 PST 2015


LO master now successfully passes "make check" under 
-fsanitize=undefined (which instruments the C/C++ code to do various 
runtime checks for undefined behavior; see 
<https://wiki.documentfoundation.org/Development/-fsanitize#-fsanitize.3Dundefined> 
for enabling it in LO).

However, I had to commit a handful of somewhat fishy changes to make 
that work, all revolving around bad downcasts of class pointers.  Most 
of them are in the context of destroying an object of derived class D, 
having reached the destructor of base class B (so "this" no longer 
points to a D, only to a B), but then the destructor of B calling out to 
some code that invalidly downcasts from B to D.  What is most fishy 
about those cases is whether it makes sense at all to do any substantial 
computation from a destructor (which parts of our code base are infamous 
for, though).

Therefore, I would appreciate it if others could take a look at those 
commits (all the commit messages contain backtrace excerpts):

* vcl:

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=6449e5bb6dd1f09678e09164ef21f455132af98f> 
"Hack to make an in-destruction SystemWindow no longer claim to be one"

* sc:

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=a015f2c125ebeff895984ff99267918932df529d> 
"Hack to work around an in-destruction ScStyleSheetPool no longer being one"

* sw:

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=5a934b2c6085d4e397e1466f8cd6a813f3c2d9d6> 
"Hack to make an in-destruction SwFlyFrm no longer claim to be one"

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=e49ca69747e9e905dbb00bbd5a7ea85331607a04> 
"Hack to make an in-destruction SwFlyInCntFrm no longer claim to be one"

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=db2c0dc78f11c2764f16e7ca4edaf2cdffc56c64> 
"Hack to make an in-destruction SwPageFrm no longer claim to be one"

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=dedc93e973b59ca4d1660fc3820770bf9b072896> 
"Hack to work around an in-destruction SwTxtNode no longer being one"

** 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=0f98299f7aa44bbb55c1bfeddca7799f727d14b0> 
"Avoid bad downcast of SwFrmFmt to SwSectionFmt" (where the SwFrmFmt 
appears to be a genuine SwFrmFmt instance, not an in-destruction 
SwSectionFmt one?)


More information about the LibreOffice mailing list