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

Commit cee45869 authored by Iustin Ventaniuc's avatar Iustin Ventaniuc Committed by Android Build Coastguard Worker
Browse files

Handle loadDescription OutOfMemoryError in DeviceAdminInfo

loadDescription was potentially vulnerable to an attack which causes a
DoS exploit by injecting a maliciously large string into the Receiver's
label.

Bug: 443062265
Test: manual
Flag: EXEMPT BUGFIX
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:06a5b2327caa3aa8843496458e98b9bb070df6e5
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:660101e3cdd2f8e8bc627517691dfb885a5c8302
Merged-In: Icab26c4b77e73f0fcb9a560e3211482ebe2f37bf
Change-Id: Icab26c4b77e73f0fcb9a560e3211482ebe2f37bf
parent a438ce17
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -473,8 +473,12 @@ public final class DeviceAdminInfo implements Parcelable {
     */
    public CharSequence loadDescription(PackageManager pm) throws NotFoundException {
        if (mActivityInfo.descriptionRes != 0) {
            try {
                return pm.getText(mActivityInfo.packageName,
                    mActivityInfo.descriptionRes, mActivityInfo.applicationInfo);
            } catch (OutOfMemoryError e) {
                throw new NotFoundException();
            }
        }
        throw new NotFoundException();
    }