diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-26 08:47:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-29 14:12:47 +0100 |
commit | 506a1b1e3d23e1e9cf0cf2e43d00447ccdcbbd92 (patch) | |
tree | fbd6a97ea7279599ffc31486fc58d8a65cfc3db3 | |
parent | ad01b0031688a3e3bb1741e4732bfa8762635478 (diff) |
Assume this wants to cap GetColumnCount()*MINLAY <= m_nWidth <= USHRT_MAX
...even if GetColumnCount()*MINLAY > USHRT_MAX could ever be true, in which case
it will now cap m_nWidth == USHRT_MAX.
(The original code didn't have the cast of GetColumnCount() to sal_Int32, then
7e7c8a51f05ef2c7c56b26e27328ad4b30655740 "#80552#: bug fixes for progress" added
a---presumably misplaced---C-style cast to the check (but not the assignment),
presumably to silence some signed-vs-unsigned warning.)
Change-Id: I2403ee3c5e8fe35ae2a7a7b7da9081a7fb7b59b1
Reviewed-on: https://gerrit.libreoffice.org/48654
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sw/source/filter/xml/xmltbli.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index bb4e532b8e37..0d45824e43ca 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -59,6 +59,7 @@ #include <vcl/svapp.hxx> #include <ndtxt.hxx> +#include <algorithm> #include <vector> #include <memory> @@ -2693,9 +2694,11 @@ void SwXMLTableContext::MakeTable() else { m_nWidth = pSize->GetWidth(); - if( m_nWidth < static_cast<sal_Int32>(GetColumnCount()) * MINLAY ) + sal_Int32 const min = static_cast<sal_Int32>( + std::min<sal_uInt32>(GetColumnCount() * MINLAY, USHRT_MAX)); + if( m_nWidth < min ) { - m_nWidth = GetColumnCount() * MINLAY; + m_nWidth = min; } else if( m_nWidth > USHRT_MAX ) { |