• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修訂6eea4a72804e1f7b20ea9cdf280ab83155c761f8 (tree)
時間2018-09-29 07:01:22
作者Michael Wachenschwanz <mwachens@goog...>
CommiterRohit Yengisetty

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)

Change Summary

差異

--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -692,11 +692,19 @@ public final class Parcel {
692692 return;
693693 }
694694 Set<Map.Entry<String,Object>> entries = val.entrySet();
695- writeInt(entries.size());
695+ int size = entries.size();
696+ writeInt(size);
697+
696698 for (Map.Entry<String,Object> e : entries) {
697699 writeValue(e.getKey());
698700 writeValue(e.getValue());
701+ size--;
699702 }
703+
704+ if (size != 0) {
705+ throw new BadParcelableException("Map size does not match number of entries!");
706+ }
707+
700708 }
701709
702710 /**