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

coverity#1242865 Untrusted loop bound

Change-Id: I9c6f821f7bd1e9bd3eb8f47e269e62a792523f1a
üst ca09871b
......@@ -241,6 +241,17 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
break;
}
case B_SBXOBJECTS:
{
//assuming an empty string with just the lead 32bit/16bit len indicator
const size_t nMinStringSize = (eCharSet == RTL_TEXTENCODING_UNICODE) ? 4 : 2;
const size_t nMinRecordSize = nMinStringSize + sizeof(sal_Int16);
const size_t nMaxRecords = r.remainingSize() / nMinRecordSize;
if (nCount > nMinRecordSize)
{
SAL_WARN("basic", "Parsing error: " << nMaxRecords <<
" max possible entries, but " << nCount << " claimed, truncating");
nCount = nMaxRecords;
}
// User defined types
for (sal_uInt16 i = 0; i < nCount; i++)
......@@ -319,9 +330,8 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
AddType(pType);
}
break;
}
case B_MODEND:
goto done;
default:
......
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