mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
LibWeb: Prevent crash when editing outside of <body>
Step 9 of this algorithm might end up at the document node, which does not have a parent.
This commit is contained in:
parent
6804ce348e
commit
90d884a150
Notes:
github-actions[bot]
2024-12-04 16:18:47 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/90d884a150e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2706
1 changed files with 5 additions and 0 deletions
|
@ -203,6 +203,11 @@ bool command_delete_action(DOM::Document& document, String const&)
|
|||
|
||||
// 9. Repeat the following steps:
|
||||
while (true) {
|
||||
// AD-HOC: If start node is not a Node, return false. This prevents a crash by dereferencing a null pointer in
|
||||
// step 1 below. Edits outside of <body> might be prohibited: https://github.com/w3c/editing/issues/405
|
||||
if (!start_node)
|
||||
return false;
|
||||
|
||||
// 1. If start offset is zero, set start offset to the index of start node and then set
|
||||
// start node to its parent.
|
||||
if (start_offset == 0) {
|
||||
|
|
Loading…
Reference in a new issue