Skip to content

13837: Fix yet another a11y crash by properly checking a string range. #7832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

// Assumed to be a temporary fix for
// https://github.com/brave/brave-browser/issues/13778
// and
// https://github.com/brave/brave-browser/issues/13837
#define BRAVE_ACCESSIBILITY_ATTRIBUTED_STRING_FOR_RANGE \
id value = [self getAXValueAsString]; \
id value = [self AXValue]; \
if (![value isKindOfClass:[NSString class]]) { \
ax::mojom::Role role = _node->GetData().role; \
base::debug::Alias(&role); \
Expand All @@ -19,6 +21,12 @@
<< " Name: " << _node->GetName(); \
base::debug::DumpWithoutCrashing(); \
return nil; \
} \
NSString* str = value; \
if (range.location == NSNotFound || \
range.location + range.length > str.length) { \
base::debug::DumpWithoutCrashing(); \
return nil; \
}

#include "../../../../ui/accessibility/platform/ax_platform_node_mac.mm"