[Libreoffice-commits] core.git: sc/source sw/source

Stephan Bergmann sbergman at redhat.com
Thu Nov 17 13:37:54 UTC 2016


 sc/source/ui/miscdlgs/autofmt.cxx |    4 ++++
 sw/source/ui/table/tautofmt.cxx   |    4 ++++
 2 files changed, 8 insertions(+)

New commits:
commit 2f976709bca1fc58e3846ceaea562af85e9a92e0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Nov 17 14:32:07 2016 +0100

    Avoid -fsanitize=signed-integer-overflow
    
    Both Writer: "Table - Insert Table... - Insert", "Table - AutoFormat Styles...";
    and Calc: select multiple cells, "Format - AutoFormat Styles..." cause
    
    > svx/source/dialog/framelinkarray.cxx:82:29: runtime error: signed integer overflow: -4702111234474983744 + -4702111234474983746 cannot be represented in type 'long'
    >     #0 0x7f84ef0e36ba in svx::frame::lclRecalcCoordVec(std::__debug::vector<long, std::allocator<long> >&, std::__debug::vector<long, std::allocator<long> > const&) svx/source/dialog/framelinkarray.cxx:82:29
    >     #1 0x7f84ef0e780e in svx::frame::ArrayImpl::GetColPosition(unsigned long) const svx/source/dialog/framelinkarray.cxx:265:9
    >     #2 0x7f84ef0f95ae in svx::frame::Array::GetColPosition(unsigned long) const svx/source/dialog/framelinkarray.cxx:762:20
    >     #3 0x7f84ef0f9e56 in svx::frame::Array::GetWidth() const svx/source/dialog/framelinkarray.cxx:787:12
    >     #4 0x7f852e9df8fd in ScAutoFmtPreview::CalcCellArray(bool) sc/source/ui/miscdlgs/autofmt.cxx:429:32
    >     #5 0x7f852e9c7740 in ScAutoFmtPreview::Init() sc/source/ui/miscdlgs/autofmt.cxx:407:5
    >     #6 0x7f852e9c9102 in ScAutoFmtPreview::ScAutoFmtPreview(vcl::Window*) sc/source/ui/miscdlgs/autofmt.cxx:73:5
    
    where -4702111234474983746 = 0xbebebebebebebebe is ASan's uninitialized value
    stored into ScAutoFmtPreview::mnLableColWidth et al.  Those (overflowing, even)
    computations on uninitialized values appear to be harmless in practice, though,
    presumably because they are overwritten with "real" values soon after.
    
    Change-Id: I487fc4681afe79c4e8532595226cba4c9c0c9b2d

diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 976c79e..4e7b9e4 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -404,6 +404,10 @@ void ScAutoFmtPreview::Init()
     SetBorderStyle( WindowBorderStyle::MONO );
     maArray.Initialize( 5, 5 );
     maArray.SetUseDiagDoubleClipping( false );
+    mnLabelColWidth = 0;
+    mnDataColWidth1 = 0;
+    mnDataColWidth2 = 0;
+    mnRowHeight = 0;
     CalcCellArray( false );
     CalcLineMap();
 }
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index df74f78..8cce069 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -825,6 +825,10 @@ void AutoFormatPreview::Init()
     SetBorderStyle( GetBorderStyle() | WindowBorderStyle::MONO );
     maArray.Initialize( 5, 5 );
     maArray.SetUseDiagDoubleClipping( false );
+    nLabelColWidth = 0;
+    nDataColWidth1 = 0;
+    nDataColWidth2 = 0;
+    nRowHeight = 0;
     CalcCellArray( false );
     CalcLineMap();
 }


More information about the Libreoffice-commits mailing list