Bug 109833 - Crash when selecting a HarfBuzz text run with SVG fonts included
Summary: Crash when selecting a HarfBuzz text run with SVG fonts included
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Unspecified
: P2 Normal
Assignee: Stephen Chenney
URL:
Keywords:
Depends on:
Blocks: 108133
  Show dependency treegraph
 
Reported: 2013-02-14 07:41 PST by Stephen Chenney
Modified: 2013-02-14 15:46 PST (History)
6 users (show)

See Also:


Attachments
Patch (5.82 KB, patch)
2013-02-14 07:56 PST, Stephen Chenney
no flags Details | Formatted Diff | Diff
Patch (9.58 KB, patch)
2013-02-14 10:40 PST, Stephen Chenney
no flags Details | Formatted Diff | Diff
Patch (5.43 KB, patch)
2013-02-14 14:56 PST, Stephen Chenney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Chenney 2013-02-14 07:41:36 PST
When an SVG font is used in a text run, and "text-rendering: optimizelegibility;" is used (or there is kerning or ligature information on the font), and the text is selected, we crash.

This is a linux only bug, I believe, or at least HarfBuzz backed by Skia only.

There are two problems:
- An assert not reached in SimpleFontData::applyTransform that is too assertive. SVG fonts may come through this path and it is not an error for them to do so.
- The code in HarfBuzzShaper::shapeHarfBuzzRuns assumes it is always dealing with HarfBuxx font data, which is not the case for SVG fonts.

Patch shortly to prevent the crash. We still do not select properly in such cases, or on other platforms.
Comment 1 Stephen Chenney 2013-02-14 07:56:37 PST
Created attachment 188353 [details]
Patch
Comment 2 WebKit Review Bot 2013-02-14 09:09:19 PST
Comment on attachment 188353 [details]
Patch

Attachment 188353 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/16538665

New failing tests:
svg/css/font-face-crash.html
Comment 3 WebKit Review Bot 2013-02-14 10:13:25 PST
Comment on attachment 188353 [details]
Patch

Attachment 188353 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/16542657

New failing tests:
svg/css/font-face-crash.html
Comment 4 Stephen Chenney 2013-02-14 10:40:03 PST
Created attachment 188382 [details]
Patch
Comment 5 Tony Chang 2013-02-14 12:04:36 PST
Comment on attachment 188382 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=188382&action=review

> LayoutTests/svg/css/font-face-crash.html:17
> +      if (window.testRunner)
> +        testRunner.waitUntilDone();

Can we add testRunner.dumpAsText() and share the results?
Comment 6 Stephen Chenney 2013-02-14 12:11:05 PST
(In reply to comment #5)
> (From update of attachment 188382 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=188382&action=review
> 
> > LayoutTests/svg/css/font-face-crash.html:17
> > +      if (window.testRunner)
> > +        testRunner.waitUntilDone();
> 
> Can we add testRunner.dumpAsText() and share the results?

It only fails if we paint (trying to paint the selection rect) and I don't think we can construct a reliable ref-test due to fonts and the selection rect (when we end up having the right selection rect).
Comment 7 Stephen Chenney 2013-02-14 12:11:38 PST
(In reply to comment #6)
> (In reply to comment #5)
> > (From update of attachment 188382 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=188382&action=review
> > 
> > > LayoutTests/svg/css/font-face-crash.html:17
> > > +      if (window.testRunner)
> > > +        testRunner.waitUntilDone();
> > 
> > Can we add testRunner.dumpAsText() and share the results?
> 
> It only fails if we paint (trying to paint the selection rect) and I don't think we can construct a reliable ref-test due to fonts and the selection rect (when we end up having the right selection rect).

And we need the timeout too.
Comment 8 Tony Chang 2013-02-14 12:38:34 PST
dumpAsText() tests still paint, we just don't compare the pixels when we're done.  I think your test will still crash with dumpAsText().

Also, you can use dumpAsText and waitUntilDone together.
Comment 9 Tony Chang 2013-02-14 12:49:10 PST
(In reply to comment #8)
> dumpAsText() tests still paint, we just don't compare the pixels when we're done.  I think your test will still crash with dumpAsText().

I verified locally on my Linux machine that we still crash on this test (release build) with dumpAsText() and without the code change.
Comment 10 Stephen Chenney 2013-02-14 14:56:20 PST
Created attachment 188435 [details]
Patch

It does paint after all. I must have had some other issue when it was earlier faiiing to crash.
Comment 11 WebKit Review Bot 2013-02-14 15:46:47 PST
Comment on attachment 188435 [details]
Patch

Clearing flags on attachment: 188435

Committed r142928: <http://trac.webkit.org/changeset/142928>
Comment 12 WebKit Review Bot 2013-02-14 15:46:51 PST
All reviewed patches have been landed.  Closing bug.