diff options
| author | Hui Yu <huiyu@google.com> | 2018-09-11 17:42:14 -0700 |
|---|---|---|
| committer | Hui Yu <huiyu@google.com> | 2018-09-12 14:16:54 -0700 |
| commit | fc451f44dcba605f4c185ff7cd4673c1b292bdca (patch) | |
| tree | c252ede9c3402237952230ae01dab6f548be24a6 /core/java/android | |
| parent | 4dc4c3ae6f5ca6d96c724f1049be06c8ebcac37e (diff) | |
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
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/os/BaseBundle.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/os/BaseBundle.java b/core/java/android/os/BaseBundle.java index 0fef78d1f4ba..3d4c00c3b480 100644 --- a/core/java/android/os/BaseBundle.java +++ b/core/java/android/os/BaseBundle.java @@ -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(); |
