Kaydet (Commit) 25e07649 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1242839 Untrusted loop bound

Change-Id: Ib0e96d20f18edfab53373f153bd128f725fe335a
üst aee93381
...@@ -1165,6 +1165,10 @@ bool MacroNames::Read( SvStream &rS) ...@@ -1165,6 +1165,10 @@ bool MacroNames::Read( SvStream &rS)
rS.ReadUInt16( iMac ); rS.ReadUInt16( iMac );
if ( iMac ) if ( iMac )
{ {
//even an empty MacroName will take 2 bytes
size_t nMaxAvailableRecords = rS.remainingSize()/sizeof(sal_uInt16);
if (iMac > nMaxAvailableRecords)
return false;
rgNames = new MacroName[ iMac ]; rgNames = new MacroName[ iMac ];
for ( sal_Int32 index = 0; index < iMac; ++index ) for ( sal_Int32 index = 0; index < iMac; ++index )
{ {
......
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