Skip to content

Commit

Permalink
gumjs: Reply with undefined when RPC method returns binary data
Browse files Browse the repository at this point in the history
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ø <[email protected]>
  • Loading branch information
oleavr and hsorbo committed May 31, 2024
1 parent b47d3c3 commit 52fa04d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bindings/gumjs/runtime/message-dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/gumjs/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -6068,7 +6068,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");
}

Expand Down

0 comments on commit 52fa04d

Please sign in to comment.