summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-26 16:38:02 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-26 20:40:49 +0100
commit5b462dff91209896e9f3d120b6dcdab85a6f1394 (patch)
tree58f22cef40c78422b2e0c274e3ced4769d7dfaad /sc
parent4c9e40653c0defd8b2b3223b32a3662bcd998837 (diff)
cid#1242796 Untrusted loop bound
Change-Id: I04e5df04747b764d4bfe035662b07a450ae0e5c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113168 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xltoolbar.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx
index 87f22f630843..7b4e40482a54 100644
--- a/sc/source/filter/excel/xltoolbar.cxx
+++ b/sc/source/filter/excel/xltoolbar.cxx
@@ -8,6 +8,7 @@
*/
#include "xltoolbar.hxx"
#include <sal/log.hxx>
+#include <o3tl/safeint.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/IndexedPropertyValues.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
@@ -346,7 +347,7 @@ ScCTBWrapper::Read( SvStream &rS)
//ScCTB is 1 TB which is min 15bytes, nViews TBVisualData which is min 20bytes
//and one 32bit number (4 bytes)
- const size_t nMinRecordSize = 19 + ctbSet.ctbViews * 20;
+ const size_t nMinRecordSize = 19 + o3tl::sanitizing_min(ctbSet.ctbViews * 20, 0);
const size_t nMaxPossibleRecords = rS.remainingSize()/nMinRecordSize;
if (ctbSet.ctb > nMaxPossibleRecords)
return false;