QFontEngine: Do not call getSfntTable with uninitalized value

On FreeType font engine this results in a call to FT_Load_Sfnt_Table
with a pointer to an uninitialized value passed in as FT_ULong* length,
crashing. Instead initialize value to 0.

Pick-to: dev
Pick-to: 5.12
Change-Id: I50d6df3b2296a05640d939e862bc50adb0fec921
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Christoph Schleifenbaum 2020-09-24 07:14:48 +02:00
parent 84cfb1aaa6
commit e041f54596

View File

@ -366,8 +366,8 @@ bool QFontEngine::supportsScript(QChar::Script script) const
if (qt_useHarfbuzzNG()) {
#if defined(Q_OS_DARWIN)
// in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
uint len;
if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len))
uint lenMort = 0, lenMorx = 0;
if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &lenMort) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &lenMorx))
return true;
#endif