summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2024-04-04 23:43:50 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-04-04 23:43:50 +0000
commitad8beac4e23df4cfdfcd640263b05641b100d33c (patch)
treed274b86a8511d5cd327bd96da46d96e7f8f466f5
parent9345b58fddea47c566ad0883aa6319bd82cd8db0 (diff)
parent9ae6eb428f811fe6340c1932a3fadc1497b8572c (diff)
Merge "Check hidden API exemptions" into sc-dev am: edd06b486a am: 8627a9fa52 am: 1caafed45f am: 6e92ef1942 am: b54160fcb0 am: 9ae6eb428f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/26721087 Change-Id: Ib88985c997b86003b7776ccd096313f1ed230c5d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/java/android/os/ZygoteProcess.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java
index 3cb5c60259eb..2b84b25b92e2 100644
--- a/core/java/android/os/ZygoteProcess.java
+++ b/core/java/android/os/ZygoteProcess.java
@@ -424,6 +424,8 @@ public class ZygoteProcess {
throw new ZygoteStartFailedEx("Embedded newlines not allowed");
} else if (arg.indexOf('\r') >= 0) {
throw new ZygoteStartFailedEx("Embedded carriage returns not allowed");
+ } else if (arg.indexOf('\u0000') >= 0) {
+ throw new ZygoteStartFailedEx("Embedded nulls not allowed");
}
}
@@ -959,6 +961,14 @@ public class ZygoteProcess {
return true;
}
+ for (/* NonNull */ String s : mApiDenylistExemptions) {
+ // indexOf() is intrinsified and faster than contains().
+ if (s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0 || s.indexOf('\u0000') >= 0) {
+ Slog.e(LOG_TAG, "Failed to set API denylist exemptions: Bad character");
+ mApiDenylistExemptions = Collections.emptyList();
+ return false;
+ }
+ }
try {
state.mZygoteOutputWriter.write(Integer.toString(mApiDenylistExemptions.size() + 1));
state.mZygoteOutputWriter.newLine();