summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-11-06 13:31:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-11-06 14:48:01 +0000
commit85005715a516d47697e3fcf86f51df35f442648d (patch)
tree05dc457e140b2bbb744ef7f78548244bc63cb4f4 /svtools
parent689f47d9c4a28468827bd0f9ed81911a024d59dc (diff)
coverity#1242570 Untrusted value as argument
Change-Id: Ic79bd1931ee291746b6dae138b3181d4baddbe3e
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/misc/imap.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index 4eebd55d9638..344372d279de 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -883,8 +883,18 @@ void ImageMap::ImpWriteImageMap( SvStream& rOStm, const OUString& rBaseURL ) con
void ImageMap::ImpReadImageMap( SvStream& rIStm, size_t nCount, const OUString& rBaseURL )
{
+ const size_t nMinRecordSize = 12; //circle, three 32bit numbers
+ const size_t nMaxRecords = rIStm.remainingSize() / nMinRecordSize;
+
+ if (nCount > nMaxRecords)
+ {
+ SAL_WARN("svtools.misc", "Parsing error: " << nMaxRecords << " max possible entries, but " <<
+ nCount << " claimed, truncating");
+ nCount = nMaxRecords;
+ }
+
// neue Objekte einlesen
- for ( size_t i = 0; i < nCount; i++ )
+ for (size_t i = 0; i < nCount; ++i)
{
sal_uInt16 nType;