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:
commit
9be245c3f0
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue