From 6746e54d04578b2e0f3108d333e0a67a64cc4452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Fri, 31 May 2024 14:03:06 +0200 Subject: [PATCH] gumjs: Disambiguate RPC reply for value and binary data --- bindings/gumjs/runtime/message-dispatcher.js | 2 +- tests/gumjs/script.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/gumjs/runtime/message-dispatcher.js b/bindings/gumjs/runtime/message-dispatcher.js index c1d1ba2fc..e6dcabad4 100644 --- a/bindings/gumjs/runtime/message-dispatcher.js +++ b/bindings/gumjs/runtime/message-dispatcher.js @@ -70,7 +70,7 @@ function MessageDispatcher() { function reply(id, type, result, params = []) { if (Array.isArray(result) && result.length === 2 && result[1] instanceof ArrayBuffer) { const [value, data] = result; - send(['frida:rpc', id, type, value, ...params], data); + send(['frida:rpc', id, type, undefined, value, ...params], data); } else if (result instanceof ArrayBuffer) { send(['frida:rpc', id, type, undefined, ...params], result); } else { diff --git a/tests/gumjs/script.c b/tests/gumjs/script.c index b442a428b..ded50975f 100644 --- a/tests/gumjs/script.c +++ b/tests/gumjs/script.c @@ -6082,7 +6082,7 @@ TESTCASE (method_can_return_value_and_binary_data) "};"); POST_MESSAGE ("[\"frida:rpc\",42,\"call\",\"read\",[]]"); EXPECT_SEND_MESSAGE_WITH_PAYLOAD_AND_DATA ( - "[\"frida:rpc\",42,\"ok\",{\"meta\":\"data\"}]", + "[\"frida:rpc\",42,\"ok\",null,{\"meta\":\"data\"}]", "59 6f"); }