@@ -711,6 +711,35 @@ TEST_P(BinderRpc, OnewayCallExhaustion) {
711711 proc.proc ->sessions .erase (proc.proc ->sessions .begin () + 1 );
712712}
713713
714+ // TODO(b/392717039): can we move this to universal tests?
715+ TEST_P (BinderRpc, SendTooLargeVector) {
716+ if (GetParam ().singleThreaded ) {
717+ GTEST_SKIP () << " Requires multi-threaded server to test one of the sessions crashing." ;
718+ }
719+
720+ auto proc = createRpcTestSocketServerProcess ({.numSessions = 2 });
721+
722+ // need a working transaction
723+ EXPECT_EQ (OK, proc.rootBinder ->pingBinder ());
724+
725+ // see libbinder internal Constants.h
726+ const size_t kTooLargeSize = 650 * 1024 ;
727+ const std::vector<uint8_t > kTestValue (kTooLargeSize / sizeof (uint8_t ), 42 );
728+
729+ // TODO(b/392717039): Telling a server to allocate too much data currently causes the session to
730+ // close since RpcServer treats any transaction error as a failure. We likely want to change
731+ // this behavior to be a soft failure, since it isn't hard to keep track of this state.
732+ sp<IBinderRpcTest> rootIface2 = interface_cast<IBinderRpcTest>(proc.proc ->sessions .at (1 ).root );
733+ std::vector<uint8_t > result;
734+ status_t res = rootIface2->repeatBytes (kTestValue , &result).transactionError ();
735+
736+ // TODO(b/392717039): consistent error results always
737+ EXPECT_TRUE (res == -ECONNRESET || res == DEAD_OBJECT) << statusToString (res);
738+
739+ // died, so remove it for checks in destructor of proc
740+ proc.proc ->sessions .erase (proc.proc ->sessions .begin () + 1 );
741+ }
742+
714743TEST_P (BinderRpc, SessionWithIncomingThreadpoolDoesntLeak) {
715744 if (clientOrServerSingleThreaded ()) {
716745 GTEST_SKIP () << " This test requires multiple threads" ;
0 commit comments