From eb19cf15a9b9d9772e5c0023c6469dfac8de74d6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 18 Aug 2016 13:11:46 +0200 Subject: 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 --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index e87064e385..9f2d0c8a33 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -867,7 +867,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) quint16 length = getUShort(names + 8 + i*NameRecordSize); quint16 offset = getUShort(names + 10 + i*NameRecordSize); - if (DWORD(string_offset + offset + length) >= bytes) + if (DWORD(string_offset + offset + length) > bytes) continue; if ((platform_id == PlatformId_Microsoft @@ -890,7 +890,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) QString strings[4]; for (int i = 0; i < 4; ++i) { - if (idStatus[0] == NotFound) + if (idStatus[i] == NotFound) continue; int id = ids[i]; quint16 length = getUShort(names + 8 + id * NameRecordSize); -- cgit v1.2.3