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

This commit is contained in:
Haoran Zhang
2023-02-24 17:48:21 +00:00
committed by Android (Google) Code Review

View File

@@ -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);