Changeset 55773 in webkit


Ignore:
Timestamp:
Mar 10, 2010 2:44:29 AM (14 years ago)
Author:
zecke@webkit.org
Message:

[CAIRO] DoS on iexploder test with high text stroke width.

https://bugs.webkit.org/show_bug.cgi?id=33759

Specifying a big text stroke width can make WebKitGTK+ spend
a very long time in the cairo library for stroking the path of
the text. The best way to prevent this from happening right now
is to not stroke paths with a certain width. Samuel proposed to
not stroke with a width that is twice the width of the text. The
reason to use twice the text width is that even one stroke of
any charachter to be drawn would cover the full width.

Test: fast/text/text-stroke-width-cairo-dos.html

WebCore:

  • platform/graphics/cairo/FontCairo.cpp:

(WebCore::Font::drawGlyphs):

Add a test case with the -webkit-text-stroke-width attribute
set to a high value to illustrate the issue.

  • fast/text/text-stroke-width-cairo-dos-expected.txt: Added.
  • fast/text/text-stroke-width-cairo-dos.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55766 r55773  
     12010-03-07  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        [CAIRO] DoS on iexploder test with high text stroke width.
     6        https://bugs.webkit.org/show_bug.cgi?id=33759
     7
     8        Add a test case with the -webkit-text-stroke-width attribute
     9        set to a high value to illustrate the issue.
     10
     11        * fast/text/text-stroke-width-cairo-dos-expected.txt: Added.
     12        * fast/text/text-stroke-width-cairo-dos.html: Added.
     13
    1142010-03-10  Roland Steiner  <rolandsteiner@chromium.org>
    215
  • trunk/WebCore/ChangeLog

    r55771 r55773  
     12010-03-07  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        [CAIRO] DoS on iexploder test with high text stroke width.
     6        https://bugs.webkit.org/show_bug.cgi?id=33759
     7
     8        Specifying a big text stroke width can make WebKitGTK+ spend
     9        a very long time in the cairo library for stroking the path of
     10        the text. The best way to prevent this from happening right now
     11        is to not stroke paths with a certain width. Samuel proposed to
     12        not stroke with a width that is twice the width of the text. The
     13        reason to use twice the text width is that even one stroke of
     14        any charachter to be drawn would cover the full width.
     15
     16        Test: fast/text/text-stroke-width-cairo-dos.html
     17
     18        * platform/graphics/cairo/FontCairo.cpp:
     19        (WebCore::Font::drawGlyphs):
     20
    1212010-03-10  Andrey Kosyakov  <caseq@chromium.org>
    222
  • trunk/WebCore/platform/graphics/cairo/FontCairo.cpp

    r54503 r55773  
    44 * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
    55 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     6 * Copyright (C) 2010 Holger Hans Peter Freyther
    67 *
    78 * Redistribution and use in source and binary forms, with or without
     
    158159    }
    159160
    160     if (context->textDrawingMode() & cTextStroke) {
     161    // Prevent running into a long computation within cairo. If the stroke width is
     162    // twice the size of the width of the text we will not ask cairo to stroke
     163    // the text as even one single stroke would cover the full wdth of the text.
     164    //  See https://bugs.webkit.org/show_bug.cgi?id=33759.
     165    if (context->textDrawingMode() & cTextStroke && context->strokeThickness() < 2 * offset) {
    161166        if (context->strokeGradient()) {
    162167            cairo_set_source(cr, context->strokeGradient()->platformGradient());
Note: See TracChangeset for help on using the changeset viewer.