mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibJS: Take a pointer in get_or_prune_cached_prototype_transition()
Prototypes can be set to null, and while the previous version also kinda allowed null (by not reading through the null reference), it was making UBSAN very sad.
This commit is contained in:
parent
db98ed5ed0
commit
36516a4c47
Notes:
sideshowbarker
2024-07-18 03:15:41 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/36516a4c473 Pull-request: https://github.com/SerenityOS/serenity/pull/10291
@ -36,9 +36,9 @@ Shape* Shape::get_or_prune_cached_forward_transition(TransitionKey const& key)
|
||||
return it->value;
|
||||
}
|
||||
|
||||
Shape* Shape::get_or_prune_cached_prototype_transition(Object& prototype)
|
||||
Shape* Shape::get_or_prune_cached_prototype_transition(Object* prototype)
|
||||
{
|
||||
auto it = m_prototype_transitions.find(&prototype);
|
||||
auto it = m_prototype_transitions.find(prototype);
|
||||
if (it == m_prototype_transitions.end())
|
||||
return nullptr;
|
||||
if (!it->value) {
|
||||
@ -71,7 +71,7 @@ Shape* Shape::create_configure_transition(const StringOrSymbol& property_name, P
|
||||
|
||||
Shape* Shape::create_prototype_transition(Object* new_prototype)
|
||||
{
|
||||
if (auto* existing_shape = get_or_prune_cached_prototype_transition(*new_prototype))
|
||||
if (auto* existing_shape = get_or_prune_cached_prototype_transition(new_prototype))
|
||||
return existing_shape;
|
||||
auto* new_shape = heap().allocate_without_global_object<Shape>(*this, new_prototype);
|
||||
m_prototype_transitions.set(new_prototype, new_shape);
|
||||
|
@ -91,7 +91,7 @@ private:
|
||||
virtual void did_become_zombie() override;
|
||||
|
||||
Shape* get_or_prune_cached_forward_transition(TransitionKey const&);
|
||||
Shape* get_or_prune_cached_prototype_transition(Object& prototype);
|
||||
Shape* get_or_prune_cached_prototype_transition(Object* prototype);
|
||||
|
||||
void ensure_property_table() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user