Changeset 287812 in webkit
- Timestamp:
- Jan 8, 2022, 10:21:55 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/lists (added)
-
LayoutTests/http/tests/lists/list-new-parent-no-sibling-append-expected.txt (added)
-
LayoutTests/http/tests/lists/list-new-parent-no-sibling-append.html (added)
-
LayoutTests/platform/gtk/http/tests/lists (added)
-
LayoutTests/platform/gtk/http/tests/lists/list-new-parent-no-sibling-append-expected.txt (added)
-
LayoutTests/platform/win/http/tests/lists (added)
-
LayoutTests/platform/win/http/tests/lists/list-new-parent-no-sibling-append-expected.txt (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/ModifySelectionListLevel.cpp (modified) (1 diff)
-
Source/WebCore/editing/VisibleUnits.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r287810 r287812 1 2022-01-08 Gabriel Nava Marino <gnavamarino@apple.com> 2 3 null ptr deref in WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange 4 https://bugs.webkit.org/show_bug.cgi?id=234862 5 6 Reviewed by Darin Adler. 7 8 * http/tests/lists/list-new-parent-no-sibling-append-expected.txt: Added. 9 * http/tests/lists/list-new-parent-no-sibling-append.html: Added. 10 * platform/gtk/http/tests/lists/list-new-parent-no-sibling-append-expected.txt: Added. 11 * platform/win/http/tests/lists/list-new-parent-no-sibling-append-expected.txt: Added. 12 1 13 2022-01-08 Tyler Wilcock <tyler_w@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r287811 r287812 1 2022-01-08 Gabriel Nava Marino <gnavamarino@apple.com> 2 3 null ptr deref in WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange 4 https://bugs.webkit.org/show_bug.cgi?id=234862 5 6 Reviewed by Darin Adler. 7 8 ModifySelectionListLevelCommand::appendSiblingNodeRange loops through nodes assuming 9 existence of siblings, which is not guaranteed, and can result in nullptr deref. Instead, 10 check for node existence as part of loop condition, and change raw pointer usage to RefPtr. 11 12 This addresses the crash but results in ASSERT(isEndOfParagraph(endOfParagraphToMove)) 13 failing in CompositeEditCommand::moveParagraph. We modify WebCore::findEndOfParagraph 14 to check for HTMLBRElement nodes to avoid unexpectedly changing the AnchorType. 15 16 Test: http/tests/lists/list-new-parent-no-sibling-append.html 17 18 * editing/ModifySelectionListLevel.cpp: 19 (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeBefore): 20 (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeAfter): 21 (WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange): 22 * editing/VisibleUnits.cpp: 23 (WebCore::findEndOfParagraph): 24 1 25 2022-01-08 Tyler Wilcock <tyler_w@apple.com> 2 26 -
trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp
r283851 r287812 93 93 void ModifySelectionListLevelCommand::insertSiblingNodeRangeBefore(Node* startNode, Node* endNode, Node* refNode) 94 94 { 95 Node*node = startNode;96 while ( 1) {97 Node*next = node->nextSibling();95 RefPtr node = startNode; 96 while (node) { 97 RefPtr next = node->nextSibling(); 98 98 removeNode(*node); 99 99 insertNodeBefore(*node, *refNode); 100 100 101 101 if (node == endNode) 102 break;102 return; 103 103 104 104 node = next; 105 105 } 106 ASSERT_NOT_REACHED(); 106 107 } 107 108 108 109 void ModifySelectionListLevelCommand::insertSiblingNodeRangeAfter(Node* startNode, Node* endNode, Node* refNode) 109 110 { 110 Node* node = startNode; 111 while (1) { 112 Node* next = node->nextSibling(); 111 RefPtr node = startNode; 112 RefPtr refChild = refNode; 113 while (node) { 114 RefPtr next = node->nextSibling(); 113 115 removeNode(*node); 114 insertNodeAfter(*node, *ref Node);116 insertNodeAfter(*node, *refChild); 115 117 116 118 if (node == endNode) 117 break;118 119 ref Node= node;119 return; 120 121 refChild = node; 120 122 node = next; 121 123 } 124 ASSERT_NOT_REACHED(); 122 125 } 123 126 124 127 void ModifySelectionListLevelCommand::appendSiblingNodeRange(Node* startNode, Node* endNode, Element* newParent) 125 128 { 126 Node*node = startNode;127 while ( 1) {128 Node*next = node->nextSibling();129 RefPtr node = startNode; 130 while (node) { 131 RefPtr next = node->nextSibling(); 129 132 removeNode(*node); 130 133 appendNode(*node, *newParent); 131 134 132 135 if (node == endNode) 133 break;136 return; 134 137 135 138 node = next; 136 139 } 140 ASSERT_NOT_REACHED(); 137 141 } 138 142 -
trunk/Source/WebCore/editing/VisibleUnits.cpp
r287520 r287812 1197 1197 1198 1198 // FIXME: This is wrong when startNode is a block. We should return a position after the block. 1199 if (r->isBR() || is Block(n))1199 if (r->isBR() || is<HTMLBRElement>(n) || isBlock(n)) 1200 1200 break; 1201 1201
Note:
See TracChangeset
for help on using the changeset viewer.