Title: [153883] trunk
- Revision
- 153883
- Author
- [email protected]
- Date
- 2013-08-09 05:08:28 -0700 (Fri, 09 Aug 2013)
Log Message
Missing NULL check in ApplyStyleCommand::applyInlineStyleToNodeRange()
https://bugs.webkit.org/show_bug.cgi?id=119570
Reviewed by Ryosuke Niwa.
Source/WebCore:
The m_mutableStyleSet of EditingStyle can be NULL in ApplyStyleCommand::applyInlineStyleToNodeRange but
this scenario was not checked earlier.
Test: editing/execCommand/null-style-crash.html
* css/StylePropertySet.cpp:
(WebCore::MutableStylePropertySet::mergeAndOverrideOnConflict):
* css/StylePropertySet.h:
* css/ViewportStyleResolver.cpp:
(WebCore::ViewportStyleResolver::addViewportRule):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
* editing/EditingStyle.cpp:
(WebCore::styleFromMatchedRulesForElement):
(WebCore::EditingStyle::mergeStyleFromRules):
(WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
LayoutTests:
* editing/execCommand/null-style-crash-expected.txt: Added.
* editing/execCommand/null-style-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (153882 => 153883)
--- trunk/LayoutTests/ChangeLog 2013-08-09 10:48:49 UTC (rev 153882)
+++ trunk/LayoutTests/ChangeLog 2013-08-09 12:08:28 UTC (rev 153883)
@@ -1,3 +1,13 @@
+2013-08-09 Renata Hodovan <[email protected]>
+
+ Missing NULL check in ApplyStyleCommand::applyInlineStyleToNodeRange()
+ https://bugs.webkit.org/show_bug.cgi?id=119570
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/execCommand/null-style-crash-expected.txt: Added.
+ * editing/execCommand/null-style-crash.html: Added.
+
2013-08-08 Tim Horton <[email protected]>
navigator.plugins has plugins in it when plugins are disabled
Added: trunk/LayoutTests/editing/execCommand/null-style-crash-expected.txt (0 => 153883)
--- trunk/LayoutTests/editing/execCommand/null-style-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/execCommand/null-style-crash-expected.txt 2013-08-09 12:08:28 UTC (rev 153883)
@@ -0,0 +1 @@
+PASS. WebKit didn't crash
Added: trunk/LayoutTests/editing/execCommand/null-style-crash.html (0 => 153883)
--- trunk/LayoutTests/editing/execCommand/null-style-crash.html (rev 0)
+++ trunk/LayoutTests/editing/execCommand/null-style-crash.html 2013-08-09 12:08:28 UTC (rev 153883)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <table>
+ <tr>
+ <td contenteditable="plaintext-only">171</td>
+ </tr>
+ </table>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ document.designMode = "on";
+ document.execCommand("SelectAll");
+ document.execCommand("CreateLink", true, 'www.google.com');
+
+ document.body.innerHTML = "PASS. WebKit didn't crash";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (153882 => 153883)
--- trunk/Source/WebCore/ChangeLog 2013-08-09 10:48:49 UTC (rev 153882)
+++ trunk/Source/WebCore/ChangeLog 2013-08-09 12:08:28 UTC (rev 153883)
@@ -1,3 +1,27 @@
+2013-08-09 Renata Hodovan <[email protected]>
+
+ Missing NULL check in ApplyStyleCommand::applyInlineStyleToNodeRange()
+ https://bugs.webkit.org/show_bug.cgi?id=119570
+
+ Reviewed by Ryosuke Niwa.
+
+ The m_mutableStyleSet of EditingStyle can be NULL in ApplyStyleCommand::applyInlineStyleToNodeRange but
+ this scenario was not checked earlier.
+
+ Test: editing/execCommand/null-style-crash.html
+
+ * css/StylePropertySet.cpp:
+ (WebCore::MutableStylePropertySet::mergeAndOverrideOnConflict):
+ * css/StylePropertySet.h:
+ * css/ViewportStyleResolver.cpp:
+ (WebCore::ViewportStyleResolver::addViewportRule):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+ * editing/EditingStyle.cpp:
+ (WebCore::styleFromMatchedRulesForElement):
+ (WebCore::EditingStyle::mergeStyleFromRules):
+ (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
+
2013-08-09 Andreas Kling <[email protected]>
ElementRuleCollector: Use range-based for syntax in rule collection loop.
Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (153882 => 153883)
--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2013-08-09 10:48:49 UTC (rev 153882)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2013-08-09 12:08:28 UTC (rev 153883)
@@ -771,7 +771,8 @@
// Add to this element's inline style and skip over its contents.
HTMLElement* element = toHTMLElement(node.get());
RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty(element->inlineStyle());
- inlineStyle->mergeAndOverrideOnConflict(*style->style());
+ if (MutableStylePropertySet* otherStyle = style->style())
+ inlineStyle->mergeAndOverrideOnConflict(*otherStyle);
setNodeAttribute(element, styleAttr, inlineStyle->asText());
next = NodeTraversal::nextSkippingChildren(node.get());
continue;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes