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
This commit is contained in:
Hui Yu
2018-09-11 17:42:14 -07:00
parent 4dc4c3ae6f
commit fc451f44dc

View File

@@ -1601,12 +1601,13 @@ public class BaseBundle {
private void readFromParcelInner(Parcel parcel, int length) {
if (length < 0) {
throw new RuntimeException("Bad length in parcel: " + length);
} else if (length == 0) {
// Empty Bundle or end of data.
mParcelledData = NoImagePreloadHolder.EMPTY_PARCEL;
mParcelledByNative = false;
return;
} else if (length % 4 != 0) {
throw new IllegalStateException("Bundle length is not aligned by 4: " + length);
}
final int magic = parcel.readInt();