commit | f8788be0545340e09672997a064de8627ade1574 | [log] [tgz] |
---|---|---|
author | TreeHugger Robot <treehugger-gerrit@google.com> | Fri Jul 31 19:24:50 2020 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Fri Jul 31 19:24:50 2020 +0000 |
tree | e7d4bee5666465188a56529614b9cce432ed2e6e | |
parent | 3b0abc441bac16d0bfdee5e798a4fcf793b9ee70 [diff] | |
parent | c44772fdd289b8b0ec9dab562bd2d3938c81477e [diff] |
Merge "Fail explicitly on length overflow." into oc-dev
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; }