diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-03-01 09:24:31 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-03-01 10:41:32 +0100 |
commit | ee049546ba57ce72610f2ac300c370fc789fe41f (patch) | |
tree | 7140bc395743a76aae4824ad6302a87284c41dc2 | |
parent | 8cc88f9473097b680f12a343d3a491926cd33847 (diff) |
Avoid unnecessary truncation to sal_uInt16
At least when CppunitTest_sw_filters_test tries to load
sw/qa/core/data/ww6/pass/crash-2.doc, Clang's
-fsanitize=implicit-signed-integer-truncation flags an "implicit conversion from
type 'unsigned int' of value 49197 (32-bit, unsigned) to type 'short' changed
the value to -16339 (16-bit, signed)" when multiplying nFSize by 10. That
document is obviously broken, LO emits lots of SAL_WARN like
"sw/source/filter/ww8/ww8scan.cxx:802: Unknown ww7- sprm, dangerous, report to
development", and at least MS Word for Mac Version 16.21 refuses to open it at
all. But even if the value of nFSize computed here is obviously way too large,
that variable is only passed into SvxFontHeightItem's sal_uLong nSz parameter,
so it can just as well be of type sal_uLong too.
Change-Id: I2e3b9152adce9c928df2276ebb2e9d526553e541
Reviewed-on: https://gerrit.libreoffice.org/68538
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 6cced653b857..c9d042205016 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3900,7 +3900,7 @@ void SwWW8ImplReader::Read_FontSize( sal_uInt16 nId, const sal_uInt8* pData, sho else { // Font-Size in half points e.g. 10 = 1440 / ( 72 * 2 ) - sal_uInt16 nFSize = eVersion <= ww::eWW2 ? *pData : SVBT16ToShort(pData); + sal_uLong nFSize = eVersion <= ww::eWW2 ? *pData : SVBT16ToShort(pData); nFSize*= 10; SvxFontHeightItem aSz( nFSize, 100, nId ); |