Kaydet (Commit) 96b524cd authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1242891 Untrusted loop bound

Change-Id: I5859cef0fa6b9c49225c5d7b073bcbc521734854
üst 5d0da4db
......@@ -150,8 +150,15 @@ void XclImpPalette::ReadPalette( XclImpStream& rStrm )
{
sal_uInt16 nCount;
rStrm >> nCount;
OSL_ENSURE( rStrm.GetRecLeft() == static_cast< sal_Size >( 4 * nCount ),
"XclImpPalette::ReadPalette - size mismatch" );
const size_t nMinRecordSize = 4;
const size_t nMaxRecords = rStrm.GetRecLeft() / nMinRecordSize;
if (nCount > nMaxRecords)
{
SAL_WARN("sc", "Parsing error: " << nMaxRecords <<
" max possible entries, but " << nCount << " claimed, truncating");
nCount = nMaxRecords;
}
maColorTable.resize( nCount );
Color aColor;
......@@ -164,7 +171,6 @@ void XclImpPalette::ReadPalette( XclImpStream& rStrm )
}
// FONT record - font information =============================================
XclImpFont::XclImpFont( const XclImpRoot& rRoot ) :
XclImpRoot( rRoot ),
mbHasCharSet( false ),
......
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