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

Commit fc451f44 authored by Hui Yu's avatar Hui Yu
Browse files

Check Bundle length is aligned by 4 when readFromParcel.

Otherwise throw an IllegalStateException.
Fix: 26885514
Test: Make the bundle length not aligned by 4 and observe the IllegalStateException.

Change-Id: I57f0d5babdf1b8f1074eb2f4f76b71926db8b93c
parent 4dc4c3ae
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1601,12 +1601,13 @@ public class BaseBundle {
    private void readFromParcelInner(Parcel parcel, int length) {
    private void readFromParcelInner(Parcel parcel, int length) {
        if (length < 0) {
        if (length < 0) {
            throw new RuntimeException("Bad length in parcel: " + length);
            throw new RuntimeException("Bad length in parcel: " + length);

        } else if (length == 0) {
        } else if (length == 0) {
            // Empty Bundle or end of data.
            // Empty Bundle or end of data.
            mParcelledData = NoImagePreloadHolder.EMPTY_PARCEL;
            mParcelledData = NoImagePreloadHolder.EMPTY_PARCEL;
            mParcelledByNative = false;
            mParcelledByNative = false;
            return;
            return;
        } else if (length % 4 != 0) {
            throw new IllegalStateException("Bundle length is not aligned by 4: " + length);
        }
        }


        final int magic = parcel.readInt();
        final int magic = parcel.readInt();