0

macOS: Fix a CHECK failure in setMarkedText

According to crash/0c6d95b50030868b, a CHECK_LE in setMarkedText fails.
This CL converts it to an `if` condition.

Bug: 40060200
Change-Id: Ifefad1e12e5469f1818853cb49bf7faa31123242
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6126238
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1401419}
This commit is contained in:
Kent Tamura
2025-01-02 07:22:26 -08:00
committed by Chromium LUCI CQ
parent a302c8e19a
commit daf40c5b9e

@ -2284,9 +2284,9 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
_markedRange.length = length;
}
if (fixLiveConversion && newSelRange.location != NSNotFound) {
if (fixLiveConversion && newSelRange.location != NSNotFound &&
_markedRange.location <= std::numeric_limits<uint32_t>::max()) {
CHECK_NE(_markedRange.location, static_cast<NSUInteger>(NSNotFound));
CHECK_LE(_markedRange.location, std::numeric_limits<uint32_t>::max());
CHECK_LE(newSelRange.location, std::numeric_limits<uint32_t>::max());
// `_markedRange.location + NSMaxRange(newSelRange)` can be larger than
// the maximum uint32_t. See crbug.com/40060200.