[webkit-reviews] review requested: [Bug 21953] Small Caps font crashes webkit : [Attachment 25023] Possible patch to issue 21953

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 10 11:26:28 PST 2008


Glenn Wilson <gwilson at google.com> has asked  for review:
Bug 21953: Small Caps font crashes webkit
https://bugs.webkit.org/show_bug.cgi?id=21953

Attachment 25023: Possible patch to issue 21953
https://bugs.webkit.org/attachment.cgi?id=25023&action=review

------- Additional Comments from Glenn Wilson <gwilson at google.com>
Here is a possible fix for this issue.

So, here's what I think is happening to cause a crash:

1.  Font calls FontCache:getFontCacheForCharacters, which gives SimpleFontData
for a given set of characters. 
2.  FontCache::getFontCacheForCharacters eventually gets the SimpleFontData
that works for the first character 'Ê', but does not have a character mapped
for the next character 'Œ'.
3.  getFontCacheForCharacters ends up returning null, because the
SimpleFontData it was trying to return doesn't contain all the characters.
4.  Font, seeing that it has the smallCaps flag, tries to call a method on the
SimpleFontData that was returned null, and it crashes.

So, this crash was caused by any html that is trying to use the small-caps
variant on a font that only contains the first character in a set of text, but
not a subsequent character.

This change merely modifies Font to not call the small caps method if
getFontCacheForCharacters returns null.  It was already doing a similar check
immediately afterwards, so this seems like the right way to guard against this
possibility.


More information about the webkit-reviews mailing list