summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-24 11:13:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-24 13:06:44 +0100
commiteca40d828fa8a5d720089cada62719bc8750ca7f (patch)
treec260c506f693a1e3e952de9071eb0642429e5ffe /oox
parent3deee910ab4304ff72846db91d90826f731c2544 (diff)
ubsan: runtime error: signed integer overflow
Change-Id: I357717d1f7c33842367179a76b2f3b840c8ef758 Reviewed-on: https://gerrit.libreoffice.org/45217 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/docprop/docprophandler.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 7a1b569e2816..9671ab26d2ca 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <o3tl/safeint.hxx>
#include <osl/time.h>
#include <osl/diagnose.h>
#include <i18nlangtag/languagetag.hxx>
@@ -501,17 +502,22 @@ void SAL_CALL OOXMLDocPropHandler::characters( const OUString& aChars )
break;
case EXTPR_TOKEN( TotalTime ):
- try
- {
- // The TotalTime is in mins as per ECMA specification.
- m_xDocProp->setEditingDuration( aChars.toInt32() * 60 );
- }
- catch (lang::IllegalArgumentException &)
+ {
+ sal_Int32 nDuration;
+ if (!o3tl::checked_multiply<sal_Int32>(aChars.toInt32(), 60, nDuration))
{
- // ignore
+ try
+ {
+ // The TotalTime is in mins as per ECMA specification.
+ m_xDocProp->setEditingDuration(nDuration);
+ }
+ catch (const lang::IllegalArgumentException&)
+ {
+ // ignore
+ }
}
break;
-
+ }
case EXTPR_TOKEN( Characters ):
case EXTPR_TOKEN( CharactersWithSpaces ):
case EXTPR_TOKEN( Pages ):