Merge "libbinder: Fix out-of-bounds abort in RpcServer" am: 09ba064c13 am: e43e5bea0f am: 80495c92a8 am: 1f9c04300a
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2146845
Change-Id: I9e256f8ac9249e29c00c4da53b2038fcfa118c27
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index ee90710..096d5cc 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -421,7 +421,9 @@
session->setMaxIncomingThreads(server->mMaxThreads);
if (!session->setProtocolVersion(protocolVersion)) return;
- if (server->mSupportedFileDescriptorTransportModes.test(
+ if (header.fileDescriptorTransportMode <
+ server->mSupportedFileDescriptorTransportModes.size() &&
+ server->mSupportedFileDescriptorTransportModes.test(
header.fileDescriptorTransportMode)) {
session->setFileDescriptorTransportMode(
static_cast<RpcSession::FileDescriptorTransportMode>(