<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>54734</bug_id>
          
          <creation_ts>2011-02-18 02:10:11 -0800</creation_ts>
          <short_desc>chrome.dll!WebCore..ApplyStyleCommand..pushDownInlineStyleAroundNode OOM (93871a71195a4feb563917607f83aaa6)</short_desc>
          <delta_ts>2011-03-28 04:02:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows Vista</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Berend-Jan Wever">skylined</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>353490</commentid>
    <comment_count>0</comment_count>
      <attachid>82936</attachid>
    <who name="Berend-Jan Wever">skylined</who>
    <bug_when>2011-02-18 02:10:11 -0800</bug_when>
    <thetext>Created attachment 82936
Repro

Chromium: http://code.google.com/p/chromium/issues/detail?id=73384
It appears that ApplyStyleCommand::pushDownInlineStyleAroundNode can go into an infinite loop and push elements into a
Vector until all memory is consumed:

http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/editing/ApplyStyleCommand.cpp&amp;q=pushDownInlineStyleAroundNode&amp;exact_package=chromium&amp;sa=N&amp;cd=1&amp;ct=rc&amp;l=1420
void ApplyStyleCommand::pushDownInlineStyleAroundNode(CSSMutableStyleDeclaration* style, Node* targetNode)
{
&lt;snip&gt;
    Vector&lt;RefPtr&lt;Element&gt; &gt; elementsToPushDown;
    while (current != targetNode) {                                   // BJW: This can be an infinite loop
&lt;snip&gt;
        if (current-&gt;isStyledElement() &amp;&amp; isStyledInlineElementToRemove(static_cast&lt;Element*&gt;(current))) {
            styledElement = static_cast&lt;StyledElement*&gt;(current);
            elementsToPushDown.append(styledElement);                 // This causes OOM in infinite loops
&lt;snip&gt;

Repro:
&lt;html&gt;
  &lt;head&gt;
    &lt;script&gt;
      function go() {
        document.designMode=&quot;on&quot;;
        document.execCommand(&quot;SelectAll&quot;);
        document.execCommand(&quot;delete&quot;);
        document.execCommand(&quot;delete&quot;,false);
        document.execCommand(&quot;insertimage&quot;,false);;
        document.execCommand(&quot;selectall&quot;);
        document.execCommand(&quot;strikethrough&quot;);
        document.execCommand(&quot;insertimage&quot;, false);
        document.execCommand(&quot;justifycenter&quot;);
        document.execCommand(&quot;InsertOrderedList&quot;);
        document.execCommand(&quot;insertimage&quot;,false);
        document.execCommand(&quot;insertorderedlist&quot;);
        document.execCommand(&quot;InsertHorizontalRule&quot;,false);
        document.execCommand(&quot;justifyright&quot;,false);
        document.execCommand(&quot;insertparagraph&quot;);
        document.execCommand(&quot;indent&quot;);
        document.execCommand(&quot;delete&quot;);
        document.execCommand(&quot;Undo&quot;);
        document.execCommand(&quot;underline&quot;);
        document.execCommand(&quot;removeformat&quot;,false);
      }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload=&quot;go()&quot;&gt;
  &lt;/body&gt;
&lt;/html&gt;

id:             chrome.dll!WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode OOM (93871a71195a4feb563917607f83aaa6)
description:    Cannot allocate enough memory in chrome.dll!WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode
application:    Chromium 11.0.671.0
stack:          chrome.dll!WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode
                chrome.dll!WebCore::ApplyStyleCommand::removeInlineStyle
                chrome.dll!WebCore::ApplyStyleCommand::applyInlineStyle
                chrome.dll!WebCore::ApplyStyleCommand::doApply
                chrome.dll!WebCore::EditCommand::apply
                chrome.dll!WebCore::CompositeEditCommand::applyCommandToComposite
                chrome.dll!WebCore::RemoveFormatCommand::doApply
                chrome.dll!WebCore::EditCommand::apply
                chrome.dll!WebCore::applyCommand
                chrome.dll!WebCore::Editor::removeFormattingAndStyle
                chrome.dll!WebCore::executeRemoveFormat
                chrome.dll!WebCore::Editor::Command::execute
                chrome.dll!WebCore::Document::execCommand
                chrome.dll!WebCore::DocumentInternal::execCommandCallback
                chrome.dll!v8::internal::HandleApiCallHelper&lt;...&gt;
                chrome.dll!v8::internal::Builtin_HandleApiCall
                chrome.dll!v8::internal::Invoke
                chrome.dll!v8::internal::Execution::Call
                ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>365351</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-03-10 11:31:57 -0800</bug_when>
    <thetext>This hang didn&apos;t reproduce with WebKit r80641 on Mac.  Could you try obtaining the DOM &amp; selection on Chrome / WebKit that reproduce the issue right before you run the last document.execCommand(&quot;removeformat&quot;,false); ?  We might still be able to reproduce the hang if we ran RemoveFormat on that DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>374393</commentid>
    <comment_count>2</comment_count>
    <who name="Berend-Jan Wever">skylined</who>
    <bug_when>2011-03-28 04:02:25 -0700</bug_when>
    <thetext>Sorry for the slow response, this one slipped through.

&quot;Could you try obtaining the DOM &amp; selection on Chrome / WebKit&quot; - sure, but what exactly do you mean with that?</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>82936</attachid>
            <date>2011-02-18 02:10:11 -0800</date>
            <delta_ts>2011-02-18 02:10:11 -0800</delta_ts>
            <desc>Repro</desc>
            <filename>repro.html</filename>
            <type>text/html</type>
            <size>1054</size>
            <attacher name="Berend-Jan Wever">skylined</attacher>
            
              <data encoding="base64">PGh0bWw+CiAgPGhlYWQ+CiAgICA8c2NyaXB0PgogICAgICBmdW5jdGlvbiBnbygpIHsKICAgICAg
ICBkb2N1bWVudC5kZXNpZ25Nb2RlPSJvbiI7CiAgICAgICAgZG9jdW1lbnQuZXhlY0NvbW1hbmQo
IlNlbGVjdEFsbCIpOwogICAgICAgIGRvY3VtZW50LmV4ZWNDb21tYW5kKCJkZWxldGUiKTsKICAg
ICAgICBkb2N1bWVudC5leGVjQ29tbWFuZCgiZGVsZXRlIixmYWxzZSk7CiAgICAgICAgZG9jdW1l
bnQuZXhlY0NvbW1hbmQoImluc2VydGltYWdlIixmYWxzZSk7OwogICAgICAgIGRvY3VtZW50LmV4
ZWNDb21tYW5kKCJzZWxlY3RhbGwiKTsKICAgICAgICBkb2N1bWVudC5leGVjQ29tbWFuZCgic3Ry
aWtldGhyb3VnaCIpOwogICAgICAgIGRvY3VtZW50LmV4ZWNDb21tYW5kKCJpbnNlcnRpbWFnZSIs
IGZhbHNlKTsKICAgICAgICBkb2N1bWVudC5leGVjQ29tbWFuZCgianVzdGlmeWNlbnRlciIpOwog
ICAgICAgIGRvY3VtZW50LmV4ZWNDb21tYW5kKCJJbnNlcnRPcmRlcmVkTGlzdCIpOwogICAgICAg
IGRvY3VtZW50LmV4ZWNDb21tYW5kKCJpbnNlcnRpbWFnZSIsZmFsc2UpOwogICAgICAgIGRvY3Vt
ZW50LmV4ZWNDb21tYW5kKCJpbnNlcnRvcmRlcmVkbGlzdCIpOwogICAgICAgIGRvY3VtZW50LmV4
ZWNDb21tYW5kKCJJbnNlcnRIb3Jpem9udGFsUnVsZSIsZmFsc2UpOwogICAgICAgIGRvY3VtZW50
LmV4ZWNDb21tYW5kKCJqdXN0aWZ5cmlnaHQiLGZhbHNlKTsKICAgICAgICBkb2N1bWVudC5leGVj
Q29tbWFuZCgiaW5zZXJ0cGFyYWdyYXBoIik7CiAgICAgICAgZG9jdW1lbnQuZXhlY0NvbW1hbmQo
ImluZGVudCIpOwogICAgICAgIGRvY3VtZW50LmV4ZWNDb21tYW5kKCJkZWxldGUiKTsKICAgICAg
ICBkb2N1bWVudC5leGVjQ29tbWFuZCgiVW5kbyIpOwogICAgICAgIGRvY3VtZW50LmV4ZWNDb21t
YW5kKCJ1bmRlcmxpbmUiKTsKICAgICAgICBkb2N1bWVudC5leGVjQ29tbWFuZCgicmVtb3ZlZm9y
bWF0IixmYWxzZSk7CiAgICAgIH0KICAgIDwvc2NyaXB0PgogIDwvaGVhZD4KICA8Ym9keSBvbmxv
YWQ9ImdvKCkiPgogIDwvYm9keT4KPC9odG1sPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>