summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Haoran Zhang <haoranzhang@google.com> 2023-02-24 17:48:21 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-02-24 17:48:21 +0000
commit51009536ce4aee43f42a103a0ec89e822e8e5f5f (patch)
treed094893ca3f5684ad0d211371f87bd556e3423bd
parent670778a1e642f4e33ccb40b35d9580436707065d (diff)
parent8e3f12f30546380c6fe7564adc5344c7e4b4380e (diff)
Merge "Since we are using string.subString(startIndex, endIndex) when parsing denylist, we should make sure startIndex <= endIndex before calling string.substring(). Otherwise, an index out of bound excpetion would throw and make the app terminate. This could happen if we are not careful with the denylist and make the denylist wrong formatted. For example, a ";" is left out in the end, and startIndex in this case would become -1." into udc-dev
-rw-r--r--core/java/android/view/autofill/AutofillManager.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index bdc7333f2751..aef0e651ff8d 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -899,9 +899,10 @@ public final class AutofillManager {
// 3. Get the activity names substring between the indexes
final int activityStringStartIndex = packageInStringIndex + packageName.length() + 1;
- if (activityStringStartIndex < firstNextSemicolonIndex) {
+ if (activityStringStartIndex >= firstNextSemicolonIndex) {
Log.e(TAG, "Failed to get denied activity names from denylist because it's wrongly "
+ "formatted");
+ return;
}
final String activitySubstring =
denyListString.substring(activityStringStartIndex, firstNextSemicolonIndex);