String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I22f6b8299b4b77be31859a10b14efe01b297d531
This commit is contained in:
Steven Moreland 2020-07-14 15:51:29 +00:00 committed by Automerger Merge Worker
commit 9be245c3f0
1 changed files with 1 additions and 1 deletions

View File

@ -402,7 +402,7 @@ status_t String16::remove(size_t len, size_t begin)
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;
}