Fix ubsan failure in android::base::Split.
ubsan doesn't like us incrementing std::string::npos, even if we won't use
the result.
Bug: http://b/28729303
Test: ran tests
Change-Id: I8227eca57dc6f3e49626c7025514caa04ef18f0a
diff --git a/base/strings.cpp b/base/strings.cpp
index 46fe939..bfdaf12 100644
--- a/base/strings.cpp
+++ b/base/strings.cpp
@@ -36,11 +36,12 @@
size_t base = 0;
size_t found;
- do {
+ while (true) {
found = s.find_first_of(delimiters, base);
result.push_back(s.substr(base, found - base));
+ if (found == s.npos) break;
base = found + 1;
- } while (found != s.npos);
+ }
return result;
}