commit | 37075eddc738e86576c19bf6181641befea849c8 | [log] [tgz] |
---|---|---|
author | Ivan Lozano <ivanlozano@google.com> | Wed Nov 08 18:57:16 2017 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Wed Nov 08 18:57:16 2017 +0000 |
tree | 7b28178b53c6240e388bec29a5f993d0effa3219 | |
parent | 1b82e2e2f8312adc45107e110d191ca6fb144d8c [diff] | |
parent | e52ee1a82a91264db5f2c56ce882892cb4bb0c09 [diff] |
Merge "Fix sanitizer errors in bootstat.cpp."
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index 8c11289..2d34e2d 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp
@@ -388,9 +388,11 @@ 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; }