Kaydet (Commit) 71b87e38 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1242531 Untrusted value as argument

Change-Id: I86e872251f7b8b0818a91c4a133f363e76be5f34
üst cbe24d89
......@@ -1540,6 +1540,14 @@ SvStream& ReadPolygon( SvStream& rIStream, Polygon& rPoly )
// read all points and create array
rIStream.ReadUInt16( nPoints );
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 ( rPoly.mpImplPolygon->mnRefCount != 1 )
{
if ( rPoly.mpImplPolygon->mnRefCount )
......@@ -1551,12 +1559,6 @@ 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.GetEndian() == SvStreamEndian::BIG )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment