summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-28 10:51:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-10-28 15:06:31 +0000
commit1f6aefcf2dc50a678561c9b3884d973481788821 (patch)
treeb5f59fae7b911f9cc1c0516c9b64baf97ac8323a /tools
parent95e93e9a16e19fe25737ac7eda7328ba927834ea (diff)
coverity#1242531 Untrusted loop bound
Change-Id: I94308a517028a62ecf7018f6d7a4e9d37c0f56a6
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/poly.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 56b224bf5ef2..dc3f70e59b1e 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1551,6 +1551,12 @@ SvStream& ReadPolygon( SvStream& rIStream, Polygon& rPoly )
{
// Determine whether we need to write through operators
+ const size_t nMaxRecordsPossible = rIStream.remainingSize() / (2 * sizeof(sal_Int32));
+ if (nPoints > nMaxRecordsPossible)
+ {
+ SAL_WARN("tools", "Polygon claims " << nPoints << " records, but only " << nMaxRecordsPossible << " possible");
+ nPoints = nMaxRecordsPossible;
+ }
#if (SAL_TYPES_SIZEOFLONG) == 4
#ifdef OSL_BIGENDIAN
if ( rIStream.GetNumberFormatInt() == NUMBERFORMAT_INT_BIGENDIAN )