Skip to content

Commit

Permalink
AX: AXCoreObject::enumerateDescendants is missing a null check on obj…
Browse files Browse the repository at this point in the history
…ect children

https://bugs.webkit.org/show_bug.cgi?id=259138
rdar://100626906

Reviewed by Chris Fleizach.

Prevent nullptr crashes by checking that each child from
AXCoreObject::children() is not null in AXCoreObject::enumerateDescendants.

In a future patch, we should make `AccessibilityChildrenVector` be a Vector of `Ref`s
rather than a Vector of `RefPtr`s as it is today. RefPtr does not make sense for this
type -- either we have a child or we don't.

* Source/WebCore/accessibility/AccessibilityObjectInterface.h:
(WebCore::Accessibility::enumerateDescendants):

Canonical link: https://commits.webkit.org/265992@main
  • Loading branch information
twilco authored and ddkilzer committed Jul 12, 2023
1 parent d8e3ea4 commit a17521a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/WebCore/accessibility/AccessibilityObjectInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1935,8 +1935,10 @@ void enumerateDescendants(T& object, bool includeSelf, const F& lambda)
if (includeSelf)
lambda(object);

for (const auto& child : object.children())
enumerateDescendants(*child, true, lambda);
for (const auto& child : object.children()) {
if (child)
enumerateDescendants(*child, true, lambda);
}
}

template<typename U> inline void performFunctionOnMainThreadAndWait(U&& lambda)
Expand Down

0 comments on commit a17521a

Please sign in to comment.