Skip to content

Commit 1c74365

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Sanity check network stats coming from disk." into jb-mr1-dev
2 parents e96e0a1 + b0a579f commit 1c74365

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/java/android/net/NetworkStatsHistory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ public NetworkStatsHistory(DataInputStream in) throws IOException {
177177
throw new ProtocolException("unexpected version: " + version);
178178
}
179179
}
180+
181+
if (bucketStart.length != bucketCount || rxBytes.length != bucketCount
182+
|| rxPackets.length != bucketCount || txBytes.length != bucketCount
183+
|| txPackets.length != bucketCount || operations.length != bucketCount) {
184+
throw new ProtocolException("Mismatched history lengths");
185+
}
180186
}
181187

182188
public void writeToStream(DataOutputStream out) throws IOException {

0 commit comments

Comments
 (0)