Skip to content

Commit 864e291

Browse files
committed
7546: Dumb fix to prevent crash related to accessibility keyboard.
Fixes brave/brave-browser#7546 Related upstream bugs: https://bugs.chromium.org/p/chromium/issues/detail?id=1029719 https://bugs.chromium.org/p/chromium/issues/detail?id=1133086 It is pretty hard to craft a proper fix so we just add an extra check and try to return quickly (along with sending a pseudo crash dump).
1 parent 464541e commit 864e291

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
4+
* You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
6+
#include "base/debug/dump_without_crashing.h"
7+
8+
#define BRAVE_FORPARAMETER \
9+
if (startOffset < 0 || endOffset < 0) { \
10+
base::debug::DumpWithoutCrashing(); \
11+
return nil; \
12+
}
13+
14+
#include "../../../../../../../content/browser/accessibility/browser_accessibility_cocoa.mm"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
2+
index d792b573258714648c8ce66bedc2fbb4e7417028..76bf56f79848d72067cee0835611962dc791cc55 100644
3+
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
4+
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
5+
@@ -3164,6 +3164,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
6+
endObject = range.focus()->GetAnchor();
7+
startOffset = range.anchor()->text_offset();
8+
endOffset = range.focus()->text_offset();
9+
+ BRAVE_FORPARAMETER
10+
DCHECK(startObject && endObject);
11+
DCHECK_GE(startOffset, 0);
12+
DCHECK_GE(endOffset, 0);

0 commit comments

Comments
 (0)