diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-02-27 21:19:21 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-02-28 09:27:02 +0100 |
commit | 0d0119efd526c17018044a805347d5bce195065a (patch) | |
tree | a78f77337054269351e1df9345c3d43450e3e754 /l10ntools/source | |
parent | 8ae5a98852c2f3d87d6efff598f0c7d54df835d3 (diff) |
In FitToAcutalSize, keep SwColumn's width >= left + right borders
Given SwColumn::m_nWish is documented as "Desired width, borders included."
(sw/inc/fmtclds.hxx), it appears that the invariant
GetWishWidth() >= GetLeft() + GetRight()
should always hold for SwColumn instances.
However, during UITest_writer_tests4's test_tdf113284 loading of
sw/qa/uitest/writer_tests/data/tdf113284.odt, it appears that some five-column
table is created for which initially all SwColumns'
GetWishWidth() = 13107
GetLeft() = 144 (except for first SwColumn, where it's 0)
GetRight() = 144 (except for last SwColumn, where it's 0)
and later FitToActualSize is called reducing each SwColunn to
GetWishWidth() = 286
so that for most SwColumns (except first and last), GetLeft() + GetRight() = 288
would exceed GetWishWidth(). And then (still during loading of the test's
document), SwFormatCol::CalcPrtColWidth (sw/source/core/layout/atrfrm.cxx) is
called for such a problematic SwColumn, trying to subtract from its
GetWishWidth() (the result of SwFormatCol::CalcColWidth) both GetLeft() and
GetRight(), and store that into sal_uInt16 nRet. Which triggers Clang's
-fsanitize=implicit-signed-integer-truncation "runtime error: implicit
conversion from type 'int' of value -2 (32-bit, signed) to type 'sal_uInt16'
(aka 'unsigned short') changed the value to 65534 (16-bit, unsigned)".
So make sure that FitToAcutalSize upholds that presumed SwColumns invariant,
shrinking the borders as necessary.
Change-Id: I3f6fc07e65a0fc5d5f58c99f1dcdea4467b825f0
Reviewed-on: https://gerrit.libreoffice.org/68463
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'l10ntools/source')
0 files changed, 0 insertions, 0 deletions