Skip to content

Commit c04059f

Browse files
authored
Merge pull request #7832 from brave/ie_a11y_crash
13837: Fix yet another a11y crash by properly checking a string range.
2 parents 34f7db3 + f72671e commit c04059f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

chromium_src/ui/accessibility/platform/ax_platform_node_mac.mm

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88

99
// Assumed to be a temporary fix for
1010
// https://github.com/brave/brave-browser/issues/13778
11+
// and
12+
// https://github.com/brave/brave-browser/issues/13837
1113
#define BRAVE_ACCESSIBILITY_ATTRIBUTED_STRING_FOR_RANGE \
12-
id value = [self getAXValueAsString]; \
14+
id value = [self AXValue]; \
1315
if (![value isKindOfClass:[NSString class]]) { \
1416
ax::mojom::Role role = _node->GetData().role; \
1517
base::debug::Alias(&role); \
@@ -19,6 +21,12 @@
1921
<< " Name: " << _node->GetName(); \
2022
base::debug::DumpWithoutCrashing(); \
2123
return nil; \
24+
} \
25+
NSString* str = value; \
26+
if (range.location == NSNotFound || \
27+
range.location + range.length > str.length) { \
28+
base::debug::DumpWithoutCrashing(); \
29+
return nil; \
2230
}
2331

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

0 commit comments

Comments
 (0)