Skip to content

Commit

Permalink
Bug 1866462 - Avoid seqno desync with multiple trigger messages in fu…
Browse files Browse the repository at this point in the history
…zzing. r=truber

Depends on D194644

Differential Revision: https://phabricator.services.mozilla.com/D194645
  • Loading branch information
choller committed Nov 28, 2023
1 parent ddb5ba8 commit d7ee7ec
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions tools/fuzzing/ipc/IPCFuzzController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ bool IPCFuzzController::ObserveIPCMessage(mozilla::ipc::NodeChannel* channel,
channel->mBlockSendRecv = true;
}
return true;
} else if (aMessage.type() == mIPCTriggerMsg) {
} else if (aMessage.type() == mIPCTriggerMsg && !Nyx::instance().started()) {
MOZ_FUZZING_NYX_PRINT("DEBUG: Ready message detected.\n");

if (!haveTargetNodeName && !!getenv("MOZ_FUZZ_PROTOID_FILTER")) {
Expand Down Expand Up @@ -332,22 +332,19 @@ bool IPCFuzzController::ObserveIPCMessage(mozilla::ipc::NodeChannel* channel,

// The ready message indicates the right node name for us to work with
// and we should only ever receive it once.
if (haveTargetNodeName) {
MOZ_FUZZING_NYX_PRINT("ERROR: Received ready signal twice?!\n");
return false;
}

targetNodeName = channel->GetName();
haveTargetNodeName = true;
if (!haveTargetNodeName) {
targetNodeName = channel->GetName();
haveTargetNodeName = true;

// We can also use this message as the base template for other messages
if (!this->sampleHeader.initLengthUninitialized(
sizeof(IPC::Message::Header))) {
MOZ_FUZZING_NYX_ABORT("sampleHeader.initLengthUninitialized failed\n");
}

// We can also use this message as the base template for other messages
if (!this->sampleHeader.initLengthUninitialized(
sizeof(IPC::Message::Header))) {
MOZ_FUZZING_NYX_ABORT("sampleHeader.initLengthUninitialized failed\n");
memcpy(sampleHeader.begin(), aMessage.header(),
sizeof(IPC::Message::Header));
}

memcpy(sampleHeader.begin(), aMessage.header(),
sizeof(IPC::Message::Header));
} else if (haveTargetNodeName && targetNodeName != channel->GetName()) {
// Not our node, no need to observe
return true;
Expand Down

0 comments on commit d7ee7ec

Please sign in to comment.