[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

zecke at webkit.org zecke at webkit.org
Thu Apr 8 02:18:29 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 0534cef78aa3a0d72afe6074ea46d181a032093e
Author: zecke at webkit.org <zecke at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 10 10:44:29 2010 +0000

    [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.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55773 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9d47289..798cf00 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-07  Holger Hans Peter Freyther  <zecke at selfish.org>
+
+        Reviewed by Darin Adler.
+
+        [CAIRO] DoS on iexploder test with high text stroke width.
+        https://bugs.webkit.org/show_bug.cgi?id=33759
+
+        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.
+
 2010-03-10  Roland Steiner  <rolandsteiner at chromium.org>
 
         Reviewed by David Levin.
diff --git a/LayoutTests/fast/text/text-stroke-width-cairo-dos-expected.txt b/LayoutTests/fast/text/text-stroke-width-cairo-dos-expected.txt
new file mode 100644
index 0000000..a6a00ed
--- /dev/null
+++ b/LayoutTests/fast/text/text-stroke-width-cairo-dos-expected.txt
@@ -0,0 +1 @@
+If you can read this you have survived the Cairo DOS.
diff --git a/LayoutTests/fast/text/text-stroke-width-cairo-dos.html b/LayoutTests/fast/text/text-stroke-width-cairo-dos.html
new file mode 100644
index 0000000..95b84ef
--- /dev/null
+++ b/LayoutTests/fast/text/text-stroke-width-cairo-dos.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+</head>
+<body>
+<p style="-webkit-text-stroke-width: 11037351">If you can read this you have survived the Cairo DOS.</p>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d56ddf6..c0b0da9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-03-07  Holger Hans Peter Freyther  <zecke at selfish.org>
+
+        Reviewed by Darin Adler.
+
+        [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
+
+        * platform/graphics/cairo/FontCairo.cpp:
+        (WebCore::Font::drawGlyphs):
+
 2010-03-10  Andrey Kosyakov  <caseq at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp
index 169c74c..c2aae49 100644
--- a/WebCore/platform/graphics/cairo/FontCairo.cpp
+++ b/WebCore/platform/graphics/cairo/FontCairo.cpp
@@ -3,6 +3,7 @@
  * Copyright (C) 2006 Michael Emmel mike.emmel at gmail.com
  * Copyright (C) 2007, 2008 Alp Toker <alp at atoker.com>
  * Copyright (C) 2009 Dirk Schulze <krit at webkit.org>
+ * Copyright (C) 2010 Holger Hans Peter Freyther
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -157,7 +158,11 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
         }
     }
 
-    if (context->textDrawingMode() & cTextStroke) {
+    // Prevent running into a long computation within cairo. If the stroke width is
+    // twice the size of the width of the text we will not ask cairo to stroke
+    // the text as even one single stroke would cover the full wdth of the text.
+    //  See https://bugs.webkit.org/show_bug.cgi?id=33759.
+    if (context->textDrawingMode() & cTextStroke && context->strokeThickness() < 2 * offset) {
         if (context->strokeGradient()) {
             cairo_set_source(cr, context->strokeGradient()->platformGradient());
             if (context->getAlpha() < 1.0f) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list