diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-07-11 11:18:53 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-07-11 11:18:53 -0700 |
commit | 1f99a483e410811473b12d8efedd79c738df7af3 (patch) | |
tree | f13955609a1e16e1525a1664ab24b04388cce37c | |
parent | 29282f99252237dd9674737d26ce72afbfdd3ac1 (diff) | |
download | frameworks_base-1f99a483e410811473b12d8efedd79c738df7af3.zip frameworks_base-1f99a483e410811473b12d8efedd79c738df7af3.tar.gz frameworks_base-1f99a483e410811473b12d8efedd79c738df7af3.tar.bz2 |
Recover from corrupt network stats.
When encountering corrupt stats, throw as IOException to allow
recovery at a higher level.
Bug: 9794832
Change-Id: I38d000b3bd8a4c99389c40a87ee0699efb6e9049
-rw-r--r-- | core/java/android/net/NetworkStatsHistory.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java index 382b25e..62d8738 100644 --- a/core/java/android/net/NetworkStatsHistory.java +++ b/core/java/android/net/NetworkStatsHistory.java @@ -639,6 +639,7 @@ public class NetworkStatsHistory implements Parcelable { @Deprecated public static long[] readFullLongArray(DataInputStream in) throws IOException { final int size = in.readInt(); + if (size < 0) throw new ProtocolException("negative array size"); final long[] values = new long[size]; for (int i = 0; i < values.length; i++) { values[i] = in.readLong(); @@ -680,6 +681,7 @@ public class NetworkStatsHistory implements Parcelable { public static long[] readVarLongArray(DataInputStream in) throws IOException { final int size = in.readInt(); if (size == -1) return null; + if (size < 0) throw new ProtocolException("negative array size"); final long[] values = new long[size]; for (int i = 0; i < values.length; i++) { values[i] = readVarLong(in); |