summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-26 14:45:45 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-26 21:38:50 +0100
commit3c0189c7f04b9b457ed5621fef68fcb1843df891 (patch)
tree7d7e8658cbbb6b1f4d8c27bf34eeb040c90b6af9 /sw
parent7ab5e5c8902de8cc7429d863b4ab6e40ad4b3bbc (diff)
ofz#6571 Integer-overflow
Change-Id: If4a0b9532c69a1b3746fab8c727f245cd2e8a131 Reviewed-on: https://gerrit.libreoffice.org/50375 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/xml/xmltbli.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 27ef0cb043e7..c82d15e75919 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/table/XCellRange.hpp>
#include <o3tl/numeric.hxx>
#include <o3tl/make_unique.hxx>
+#include <o3tl/safeint.hxx>
#include <svl/itemset.hxx>
#include <svl/zformat.hxx>
#include <sax/tools/converter.hxx>
@@ -2415,7 +2416,10 @@ void SwXMLTableContext::MakeTable_( SwTableBox *pBox )
{
if (nMinAbsColWidth == 0)
throw o3tl::divide_by_zero();
- sal_Int32 nRelCol = ( colIter->width * nMinRelColWidth) / nMinAbsColWidth;
+ sal_Int32 nVal;
+ if (o3tl::checked_multiply<sal_Int32>(colIter->width, nMinRelColWidth, nVal))
+ throw std::overflow_error("overflow in multiply");
+ sal_Int32 nRelCol = nVal / nMinAbsColWidth;
colIter->width = nRelCol;
colIter->isRelative = true;
nRelWidth += nRelCol;