Fix sanitizer errors in bootstat.cpp.
Integer overflow sanitized builds are throwing an error on the while loop decrement in the rfind function. This refactors the loop to prevent decrementing the value on the final iteration. Test: Compiled and device boots without runtime error. Bug: 30969751 Change-Id: Ice4532cce933062b3c14adf2d9749cfdea4ad84c
This commit is contained in:
parent
4b7f0fdccb
commit
045064371e
1 changed files with 4 additions and 2 deletions
|
@ -388,9 +388,11 @@ class pstoreConsole {
|
|||
if (needle.length() > pos) return std::string::npos;
|
||||
pos -= needle.length();
|
||||
// fuzzy match to maximum kBitErrorRate
|
||||
do {
|
||||
for (;;) {
|
||||
if (numError(pos, needle) != std::string::npos) return pos;
|
||||
} while (pos-- != 0);
|
||||
if (pos == 0) break;
|
||||
--pos;
|
||||
}
|
||||
return std::string::npos;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue