Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0a579f8 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Sanity check network stats coming from disk.

Throw early when structure is unstable, which allows the normal
recoverFromWtf() path to recover automatically.

Bug: 7440485
Change-Id: Ic150d17daac4de7c9ff3489025403a9b485b4620
parent 44251a70
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -177,6 +177,12 @@ public class NetworkStatsHistory implements Parcelable {
                throw new ProtocolException("unexpected version: " + version);
            }
        }

        if (bucketStart.length != bucketCount || rxBytes.length != bucketCount
                || rxPackets.length != bucketCount || txBytes.length != bucketCount
                || txPackets.length != bucketCount || operations.length != bucketCount) {
            throw new ProtocolException("Mismatched history lengths");
        }
    }

    public void writeToStream(DataOutputStream out) throws IOException {