summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2022-10-07 00:07:13 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-10-07 00:07:13 +0000
commitbbafc2e133de8ab7ee73cb50b13766e757e3c8d0 (patch)
tree05db8e443304ffc691ce31434621ef1a1081a9e3
parentf2b0478f761cbc38abce2a8584c97c1a3c16b1be (diff)
parentff68a53b1f80c880693e32293f354ae743e3e45c (diff)
Merge "libbinder: avoid uninteresting protocol version crash in fuzzer" am: fafdb185aa am: ff741c67e6 am: ff68a53b1f
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2241485 Change-Id: I4c1fb56a83ec370cae4c1103f51a68c1382186b6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/tests/parcel_fuzzer/random_parcel.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/binder/tests/parcel_fuzzer/random_parcel.cpp b/libs/binder/tests/parcel_fuzzer/random_parcel.cpp
index 4bb486bef0..edc695f81a 100644
--- a/libs/binder/tests/parcel_fuzzer/random_parcel.cpp
+++ b/libs/binder/tests/parcel_fuzzer/random_parcel.cpp
@@ -36,6 +36,11 @@ void fillRandomParcel(Parcel* p, FuzzedDataProvider&& provider, RandomParcelOpti
if (provider.ConsumeBool()) {
auto session = RpcSession::make(RpcTransportCtxFactoryRaw::make());
CHECK_EQ(OK, session->addNullDebuggingClient());
+ // Set the protocol version so that we don't crash if the session
+ // actually gets used. This isn't cheating because the version should
+ // always be set if the session init succeeded and we aren't testing the
+ // session init here (it is bypassed by addNullDebuggingClient).
+ session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION);
p->markForRpc(session);
if (options->writeHeader) {