Gracefully reject requests for absurd font sizes
Avoid overflows. Fixes: QTBUG-89899 Change-Id: Ic1a83c1704fe20be3d032358dc91ee8e751f2281 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 679750684087cad7a48921c4174a53cdf4855049) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5463f25586
commit
1a07e78992
@ -2386,6 +2386,12 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &request, int script)
|
||||
return engine;
|
||||
}
|
||||
|
||||
if (request.pixelSize > 0xffff) {
|
||||
// Stop absurd requests reaching the engines; pixel size is assumed to fit ushort
|
||||
qCDebug(lcFontMatch, "Rejecting request for pixel size %g2, returning box engine", double(request.pixelSize));
|
||||
return new QFontEngineBox(32); // not request.pixelSize, to avoid overflow/DOS
|
||||
}
|
||||
|
||||
QString family_name, foundry_name;
|
||||
const QString requestFamily = request.families.size() > 0 ? request.families.at(0) : request.family;
|
||||
parseFontName(requestFamily, foundry_name, family_name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user