commit | 9be245c3f0317869606eb2656162d7798eb254fd | [log] [tgz] |
---|---|---|
author | Steven Moreland <smoreland@google.com> | Tue Jul 14 15:51:29 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Jul 14 15:51:29 2020 +0000 |
tree | a7f84e60f1d53db93f972f0c1fd2e6cd8eac656a | |
parent | 3f273f49f1d9274b1637676c336d031f3a85646e [diff] | |
parent | 107f18cb619750458bce5f4a1ab3b6d3f9f9885d [diff] |
String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802 Change-Id: I22f6b8299b4b77be31859a10b14efe01b297d531
diff --git a/libutils/String16.cpp b/libutils/String16.cpp index e8f1c51..7055fc6 100644 --- a/libutils/String16.cpp +++ b/libutils/String16.cpp
@@ -402,7 +402,7 @@ mString = getEmptyString(); return NO_ERROR; } - if ((begin+len) > N) len = N-begin; + if (len > N || len > N - begin) len = N - begin; if (begin == 0 && len == N) { return NO_ERROR; }