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

Commit 06af4692 authored by Gavin Li's avatar Gavin Li Committed by Gavin Li
Browse files

StrictMode: fix deserialization of ViolationInfo on large stacks

When a large stack trace is encountered, one too many ViolationInfo
objects would be drained, which may cause a system_server crash
when readStringArray() is called on incorrect data.

Change-Id: Icb30d0402638ea5b6d63004b598d2f0bb276d685
parent f916524f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1931,9 +1931,9 @@ public final class StrictMode {
                // so we'll report it and bail on all of the current strict mode violations
                // we currently are maintaining for this thread.
                // First, drain the remaining violations from the parcel.
                while (i < numViolations) {
                i++;  // Skip the current entry.
                for (; i < numViolations; i++) {
                    info = new ViolationInfo(p, !currentlyGathering);
                    i++;
                }
                // Next clear out all gathered violations.
                clearGatheredViolations();