mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-15 14:51:52 +00:00
LibWeb: Correct logic for removing end nodes from HTMLOptionsCollection
This test case would previously crash. Found with domato.
This commit is contained in:
parent
f61e54b10c
commit
0cec68ea99
Notes:
github-actions[bot]
2024-07-27 19:24:14 +00:00
Author: https://github.com/AtkinsSJ
Commit: 0cec68ea99
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/865
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 17 additions and 2 deletions
|
@ -66,8 +66,8 @@ WebIDL::ExceptionOr<void> HTMLOptionsCollection::set_length(WebIDL::UnsignedLong
|
|||
auto n = current - value;
|
||||
|
||||
// 3.2. Remove the last n nodes in the collection from their parent nodes.
|
||||
for (WebIDL::UnsignedLong i = current - 1; i >= current - n; i--)
|
||||
this->item(i)->remove();
|
||||
for (auto i = 0u; i < n; i++)
|
||||
item(length() - 1)->remove();
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue