diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-08-18 13:11:46 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-25 11:00:30 +0000 |
commit | eb19cf15a9b9d9772e5c0023c6469dfac8de74d6 (patch) | |
tree | c342b5e665b00610f9c868982c7256df2ab7e822 /src/plugins/platforms/windows | |
parent | e83f6aaaa6b1caa59e4dd2c304439e1fb2572d71 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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); |