summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-11-17 14:32:07 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-11-17 14:32:07 +0100
commit2f976709bca1fc58e3846ceaea562af85e9a92e0 (patch)
tree3b4ea9ea22aaf610d1a8db842d7f76b6b3907353
parent447a65db6b7ea2ed580f2fdd364ac6084cc282be (diff)
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
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx4
-rw-r--r--sw/source/ui/table/tautofmt.cxx4
2 files changed, 8 insertions, 0 deletions
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 976c79eedf57..4e7b9e44ec68 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 df74f780cc88..8cce0698cca7 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();
}