Loading base/Android.bp +6 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ cc_library { cppflags: libbase_cppflags, export_include_dirs: ["include"], shared_libs: ["liblog"], sanitize: { misc_undefined: ["integer"], }, target: { android: { srcs: [ Loading Loading @@ -97,6 +100,9 @@ cc_test { "strings_test.cpp", "test_main.cpp", ], sanitize: { misc_undefined: ["integer"], }, target: { android: { srcs: [ Loading base/strings.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -36,11 +36,12 @@ std::vector<std::string> Split(const std::string& s, 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; } Loading base/strings_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -251,3 +251,7 @@ TEST(strings, EqualsIgnoreCase) { ASSERT_FALSE(android::base::EqualsIgnoreCase("foo", "bar")); ASSERT_FALSE(android::base::EqualsIgnoreCase("foo", "fool")); } TEST(strings, ubsan_28729303) { android::base::Split("/dev/null", ":"); } Loading
base/Android.bp +6 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ cc_library { cppflags: libbase_cppflags, export_include_dirs: ["include"], shared_libs: ["liblog"], sanitize: { misc_undefined: ["integer"], }, target: { android: { srcs: [ Loading Loading @@ -97,6 +100,9 @@ cc_test { "strings_test.cpp", "test_main.cpp", ], sanitize: { misc_undefined: ["integer"], }, target: { android: { srcs: [ Loading
base/strings.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -36,11 +36,12 @@ std::vector<std::string> Split(const std::string& s, 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; } Loading
base/strings_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -251,3 +251,7 @@ TEST(strings, EqualsIgnoreCase) { ASSERT_FALSE(android::base::EqualsIgnoreCase("foo", "bar")); ASSERT_FALSE(android::base::EqualsIgnoreCase("foo", "fool")); } TEST(strings, ubsan_28729303) { android::base::Split("/dev/null", ":"); }