Skip to content

Commit

Permalink
Bug 1863729 - IPC Fuzzing: Add MOZ_FUZZ_DUMP_FILTER. r=truber
Browse files Browse the repository at this point in the history
  • Loading branch information
choller committed Nov 13, 2023
1 parent b9069ea commit 367939a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tools/fuzzing/ipc/IPCFuzzController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,12 +1024,30 @@ UniquePtr<IPC::Message> IPCFuzzController::replaceIPCMessage(
return aMsg;
}

static bool dumpFilterInitialized = false;
static std::string dumpFilter;
if (!dumpFilterInitialized) {
const char* dumpFilterStr = getenv("MOZ_FUZZ_DUMP_FILTER");
if (dumpFilterStr) {
dumpFilter = std::string(dumpFilterStr);
}
dumpFilterInitialized = true;
}

if (aMsg->type() != mIPCTriggerMsg) {
if ((mIPCDumpMsg && aMsg->type() == mIPCDumpMsg.value()) ||
(mIPCDumpAllMsgsSize.isSome() &&
aMsg->Buffers().Size() >= mIPCDumpAllMsgsSize.value())) {
dumpIPCMessageToFile(aMsg, mIPCDumpCount);
mIPCDumpCount++;
if (!dumpFilter.empty()) {
std::string msgName(IPC::StringFromIPCMessageType(aMsg->type()));
if (msgName.find(dumpFilter) != std::string::npos) {
dumpIPCMessageToFile(aMsg, mIPCDumpCount);
mIPCDumpCount++;
}
} else {
dumpIPCMessageToFile(aMsg, mIPCDumpCount);
mIPCDumpCount++;
}
}

// Not the trigger message. Output additional information here for
Expand Down

0 comments on commit 367939a

Please sign in to comment.