Avoid assuming string_view iterators are char*

This assumption is non-portable and prevents Chromium from using
bounded iterators in libc++.

Bug: chromium: 1519908
Change-Id: Iafe6639ef3bc896d6fa4fb3ceb7ac0b546363017
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5237292
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
This commit is contained in:
danakj 2024-01-25 18:02:30 -05:00 committed by Crashpad LUCI CQ
parent 22c386d1ac
commit a02e4935bd

View File

@ -299,14 +299,11 @@ bool StringToExceptionMask(const base::StringPiece& string,
size_t pos = -1; size_t pos = -1;
do { do {
++pos; ++pos;
const char* substring_begin = string.begin() + pos; const size_t start = pos;
pos = string.find('|', pos); pos = string.find('|', pos);
const char* substring_end = (pos == base::StringPiece::npos) base::StringPiece substring = (pos == base::StringPiece::npos)
? string.end() ? string.substr(start)
: (string.begin() + pos); : string.substr(start, pos - start);
base::StringPiece substring = string.substr(
substring_begin - string.begin(), substring_end - substring_begin);
exception_mask_t temp_mask; exception_mask_t temp_mask;
if (!StringToExceptionMask(substring, options, &temp_mask)) { if (!StringToExceptionMask(substring, options, &temp_mask)) {
return false; return false;