Skip to content

Commit f8f661c

Browse files
authored
Merge pull request #1550 from filipe-norte-red/wpe-2.46-fix-skia-font-nullptr-use
Fix nullptr dereference in font typeface handling
2 parents 73017c7 + a9b48fb commit f8f661c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ RefPtr<Font> FontCache::systemFallbackForCharacterCluster(const FontDescription&
120120
auto features = computeFeatures(description, { });
121121
auto skFontStyle = skiaFontStyle(description);
122122
auto typeface = fontManager().matchFamilyStyleCharacter(nullptr, skFontStyle, bcp47.data(), bcp47.size(), baseCharacter);
123+
if (!typeface) {
124+
typeface = SkTypeface::MakeEmpty();
125+
}
123126
auto syntheticBold = description.hasAutoFontSynthesisWeight() && skFontStyle.weight() >= SkFontStyle::kSemiBold_Weight && !typeface->isBold();
124127
auto syntheticOblique = description.hasAutoFontSynthesisStyle() && skFontStyle.slant() != SkFontStyle::kUpright_Slant && !typeface->isItalic();
125128
FontPlatformData alternateFontData(WTFMove(typeface), description.computedSize(), syntheticBold, syntheticOblique, description.orientation(), description.widthVariant(), description.textRenderingMode(), WTFMove(features));

0 commit comments

Comments
 (0)