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

coverity#1242895 Untrusted loop bound

Change-Id: Ib54ed3f18c91142f1c217f618d88e36a646cf931
üst b42d7e4f
...@@ -1534,7 +1534,16 @@ void Sc10Import::LoadTables() ...@@ -1534,7 +1534,16 @@ void Sc10Import::LoadTables()
return; return;
} }
rStream.ReadUInt16( DataCount ); rStream.ReadUInt16(DataCount);
const size_t nMinRecordSize = sizeof(sal_uInt16)*2;
const size_t nMaxRecords = rStream.remainingSize() / nMinRecordSize;
if (DataCount > nMaxRecords)
{
SAL_WARN("sc", "Parsing error: " << nMaxRecords <<
" max possible entries, but " << DataCount << " claimed, truncating");
DataCount = nMaxRecords;
}
DataStart = 0; DataStart = 0;
for (i=0; i < DataCount; i++) for (i=0; i < DataCount; i++)
{ {
......
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