From a5d48d501f7afac3586e7b18e36b282d5bb7361d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Fri, 31 May 2024 12:07:35 +0200 Subject: [PATCH] gumjs: Reply with undefined when RPC method returns binary data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of an empty object. This isn't used by clients, so this is only for semantic consistency with a method not returning any value. Co-authored-by: Håvard Sørbø --- 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 035fe03dbb..6661d04147 100644 --- a/bindings/gumjs/runtime/message-dispatcher.js +++ b/bindings/gumjs/runtime/message-dispatcher.js @@ -71,7 +71,7 @@ function MessageDispatcher() { params = params || []; if (result instanceof ArrayBuffer) - send(['frida:rpc', id, type, {}].concat(params), result); + send(['frida:rpc', id, type, undefined].concat(params), result); else send(['frida:rpc', id, type, result].concat(params)); } diff --git a/tests/gumjs/script.c b/tests/gumjs/script.c index 4642a93335..0dbd57d4f0 100644 --- a/tests/gumjs/script.c +++ b/tests/gumjs/script.c @@ -6066,7 +6066,7 @@ TESTCASE (method_can_return_binary_data) "return buf.readByteArray(2);" "};"); POST_MESSAGE ("[\"frida:rpc\",42,\"call\",\"read\",[]]"); - EXPECT_SEND_MESSAGE_WITH_PAYLOAD_AND_DATA ("[\"frida:rpc\",42,\"ok\",{}]", + EXPECT_SEND_MESSAGE_WITH_PAYLOAD_AND_DATA ("[\"frida:rpc\",42,\"ok\",null]", "59 6f"); }