Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: 提交

frameworks/base


Commit MetaInfo

修订版f1ca40e155b63f6259701e1fcf14b2844b42e90a (tree)
时间2018-09-12 08:08:46
作者Michael Wachenschwanz <mwachens@goog...>
Commiterandroid-build-team Robot

Log Message

Verify number of Map entries written to Parcel

Make sure the number of entries written by Parcel#writeMapInternal
matches the size written. If a mismatch were allowed, an exploitable
scenario could occur where the data read from the Parcel would not
match the data written.

Fixes: 112859604
Test: cts-tradefed run cts -m CtsOsTestCases -t android.os.cts.ParcelTest

Change-Id: I325d08a8b66b6e80fe76501359c41b6656848607
Merged-In: I325d08a8b66b6e80fe76501359c41b6656848607
(cherry picked from commit 057a01d1f38e9b46d3faa4059fdd7c8717681ea0)

更改概述

差异

--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -806,11 +806,19 @@ public final class Parcel {
806806 return;
807807 }
808808 Set<Map.Entry<String,Object>> entries = val.entrySet();
809- writeInt(entries.size());
809+ int size = entries.size();
810+ writeInt(size);
811+
810812 for (Map.Entry<String,Object> e : entries) {
811813 writeValue(e.getKey());
812814 writeValue(e.getValue());
815+ size--;
813816 }
817+
818+ if (size != 0) {
819+ throw new BadParcelableException("Map size does not match number of entries!");
820+ }
821+
814822 }
815823
816824 /**
Show on old repository browser