Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit befaeff5 authored by Jackal Guo's avatar Jackal Guo Committed by Android (Google) Code Review
Browse files

Merge "Limit length of the name in <uses-permission>"

parents f0623542 b7d62363
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -248,6 +248,9 @@ public class ParsingPackageUtils {
    private static final String MAX_NUM_COMPONENTS_ERR_MSG =
            "Total number of components has exceeded the maximum number: " + MAX_NUM_COMPONENTS;

    /** The maximum permission name length. */
    private static final int MAX_PERMISSION_NAME_LENGTH = 512;

    @IntDef(flag = true, prefix = { "PARSE_" }, value = {
            PARSE_CHATTY,
            PARSE_COLLECT_CERTIFICATES,
@@ -1263,6 +1266,11 @@ public class ParsingPackageUtils {
            // that may change.
            String name = sa.getNonResourceString(
                    R.styleable.AndroidManifestUsesPermission_name);
            if (TextUtils.length(name) > MAX_PERMISSION_NAME_LENGTH) {
                return input.error(INSTALL_PARSE_FAILED_MANIFEST_MALFORMED,
                        "The name in the <uses-permission> is greater than "
                                + MAX_PERMISSION_NAME_LENGTH);
            }

            int minSdkVersion =  parseMinOrMaxSdkVersion(sa,
                    R.styleable.AndroidManifestUsesPermission_minSdkVersion,