Fix reading of font names
Correct a boundary check so the last present name can be read, and correct a typo that caused non-present names to read garbage. Change-Id: Ia9d0d3af7431c1f5f02824e884efb5f6f454dc5d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
e83f6aaaa6
commit
eb19cf15a9
@ -867,7 +867,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes)
|
|||||||
|
|
||||||
quint16 length = getUShort(names + 8 + i*NameRecordSize);
|
quint16 length = getUShort(names + 8 + i*NameRecordSize);
|
||||||
quint16 offset = getUShort(names + 10 + i*NameRecordSize);
|
quint16 offset = getUShort(names + 10 + i*NameRecordSize);
|
||||||
if (DWORD(string_offset + offset + length) >= bytes)
|
if (DWORD(string_offset + offset + length) > bytes)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((platform_id == PlatformId_Microsoft
|
if ((platform_id == PlatformId_Microsoft
|
||||||
@ -890,7 +890,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes)
|
|||||||
|
|
||||||
QString strings[4];
|
QString strings[4];
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
if (idStatus[0] == NotFound)
|
if (idStatus[i] == NotFound)
|
||||||
continue;
|
continue;
|
||||||
int id = ids[i];
|
int id = ids[i];
|
||||||
quint16 length = getUShort(names + 8 + id * NameRecordSize);
|
quint16 length = getUShort(names + 8 + id * NameRecordSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user