commit | f251c1c581f2d1b9940e60e756315c5e15443990 | [log] [tgz] |
---|---|---|
author | Steven Moreland <smoreland@google.com> | Thu May 28 00:29:08 2020 +0000 |
committer | Steven Moreland <smoreland@google.com> | Thu May 28 00:31:01 2020 +0000 |
tree | b919076d3de2bedb553753db0ef3f56aa919f2ac | |
parent | ddb18842b990d31fe28ac1b901e18d7fde26df35 [diff] [blame] |
String16::remove - avoid overflow Bug: 156999009 Test: libutils_test (cases added) Change-Id: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
diff --git a/libutils/String16.cpp b/libutils/String16.cpp index d514f29..70bf5a0 100644 --- a/libutils/String16.cpp +++ b/libutils/String16.cpp
@@ -441,7 +441,7 @@ mString = getEmptyString(); return OK; } - if ((begin+len) > N) len = N-begin; + if (len > N || len > N - begin) len = N - begin; if (begin == 0 && len == N) { return OK; }