[Webkit-unassigned] [Bug 56372] New: chrome.dll!WebCore::CompositeEditCommand::insertNodeAfter ReadAV at NULL (cf23d1b576db7f88c78bb2e323691274)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 15 06:48:57 PDT 2011


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

           Summary: chrome.dll!WebCore::CompositeEditCommand::insertNodeAf
                    ter ReadAV at NULL (cf23d1b576db7f88c78bb2e323691274)
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P1
         Component: HTML Editing
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: skylined at chromium.org
                CC: rniwa at webkit.org


Created an attachment (id=85800)
 --> (https://bugs.webkit.org/attachment.cgi?id=85800&action=review)
Repro

Chromium: http://code.google.com/p/chromium/issues/detail?id=76183

It is possible to make any HTMLElement a child of the HTMLDocument. In this case HTMLElement::parentElement returns NULL because a HTMLDocument is not an HTMLElement.

It is also possible to execute CompositeEditCommand::insertNodeAfter to insert another HTMLElement after such an HTMLElement. CompositeEditCommand::insertNodeAfter calls HTMLElement::parentElement and expects it to return an HTMLElement.

Combined, this can cause NULL pointer exceptions. I'm not entirely sure where the problem is; it could be that CompositeEditCommand::insertNodeAfter should work on Nodes rather than HTMLElements. It could also be that the code should never get this far and throw a JavaScript exception if it detects this situation. I suspect the former, it makes sense considering the name of the function.

Repro:
<body onload="go()"><script>function go() {
  var sElement = ['iframe', 'img', 'embed', 'textarea'][0]; // Select which element you want to test.
  document.open();
  var oElement1 = document.appendChild(document.createElement(sElement));
  var oElement2 = oElement1.appendChild(document.createElement(sElement));
  document.designMode = "on";
  oElement1.focus();
  document.execCommand("InsertHorizontalRule");
}</script></body>

id:             chrome.dll!WebCore::CompositeEditCommand::insertNodeAfter ReadAV at NULL (cf23d1b576db7f88c78bb2e323691274)
description:    Attempt to read from unallocated NULL pointer+0x2C in chrome.dll!WebCore::CompositeEditCommand::insertNodeAfter
application:    Chromium 12.0.705.0
stack:          chrome.dll!WebCore::CompositeEditCommand::insertNodeAfter
                chrome.dll!WebCore::CompositeEditCommand::insertNodeAt
                chrome.dll!WebCore::ReplaceSelectionCommand::insertNodeAtAndUpdateNodesInserted
                chrome.dll!WebCore::ReplaceSelectionCommand::doApply
                chrome.dll!WebCore::EditCommand::apply
                chrome.dll!WebCore::applyCommand
                chrome.dll!WebCore::executeInsertFragment
                chrome.dll!WebCore::executeInsertNode
                chrome.dll!WebCore::executeInsertHorizontalRule
                chrome.dll!WebCore::Editor::Command::execute
                chrome.dll!WebCore::Document::execCommand
                ...

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list