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

coverity#1213370 Untrusted value as argument

Change-Id: I89e29dd0382c60b0aeadc9f664e8c2784e216f2f
üst 0a7b110d
...@@ -2648,6 +2648,17 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr) ...@@ -2648,6 +2648,17 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr)
*nr = 0; *nr = 0;
if (n == 0) return 0; if (n == 0) return 0;
const sal_uInt32 remaining_table_size = nTableSize-6;
const sal_uInt32 nMinRecordSize = 12;
const sal_uInt32 nMaxRecords = remaining_table_size / nMinRecordSize;
if (n > nMaxRecords)
{
SAL_WARN("vcl.fonts", "Parsing error in " << OUString::createFromAscii(ttf->fname) <<
": " << nMaxRecords << " max possible entries, but " <<
n << " claimed, truncating");
n = nMaxRecords;
}
NameRecord* rec = (NameRecord*)calloc(n, sizeof(NameRecord)); NameRecord* rec = (NameRecord*)calloc(n, sizeof(NameRecord));
for (i = 0; i < n; i++) { for (i = 0; i < n; 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