Skip to content

Commit

Permalink
gumjs: Disambiguate RPC reply for value and binary data
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed May 31, 2024
1 parent 712b1fb commit 6746e54
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 @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/gumjs/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit 6746e54

Please sign in to comment.