Skip to content

Commit 8bcaa3f

Browse files
committed
afl: use unified fuzzer mode FIXUP
1 parent c9c2098 commit 8bcaa3f

5 files changed

Lines changed: 12 additions & 14 deletions

File tree

packages/core/core.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ import {
4444
reportFinding,
4545
} from "./finding";
4646
import { getJazzerJsGlobal, jazzerJs } from "./globals";
47-
import {
48-
buildLibAflOptions,
49-
buildLibFuzzerOptions,
50-
OptionsManager,
51-
resolveEngine,
52-
} from "./options";
47+
import { buildLibAflOptions, buildLibFuzzerOptions } from "./options";
5348
import { ensureFilepath, importModule } from "./utils";
5449

5550
// Remove temporary files on exit

packages/core/options.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import fs from "fs";
1818
import os from "os";
1919
import path from "path";
2020

21-
import { OptionsManager, OptionSource } from "@jazzer.js/options";
21+
import { Mode, OptionsManager, OptionSource } from "@jazzer.js/options";
2222

2323
import { buildLibAflOptions, spawnsSubprocess } from "./options";
2424

@@ -57,7 +57,7 @@ describe("libafl options", () => {
5757
);
5858

5959
expect(buildLibAflOptions(manager)).toEqual({
60-
mode: "fuzzing",
60+
mode: Mode.Fuzzing,
6161
runs: 99,
6262
seed: 1337,
6363
maxLen: 1024,
@@ -85,14 +85,14 @@ describe("libafl options", () => {
8585
const manager = new OptionsManager(OptionSource.DefaultCLIOptions).merge(
8686
{
8787
engine: "libafl",
88-
mode: "regression",
88+
mode: Mode.Regression,
8989
fuzzerOptions: ["corpus", "-runs=1"],
9090
},
9191
OptionSource.CommandLineArguments,
9292
);
9393

9494
expect(buildLibAflOptions(manager)).toEqual({
95-
mode: "regression",
95+
mode: Mode.Regression,
9696
runs: 0,
9797
seed: 0,
9898
maxLen: 4096,

packages/fuzzer/libafl_runtime.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ import * as fs from "fs";
1919
import * as os from "os";
2020
import * as path from "path";
2121

22+
import { Mode } from "@jazzer.js/options";
23+
2224
import { addon } from "./addon";
2325
import { fuzzer } from "./fuzzer";
2426

2527
const libAflOptions = {
26-
mode: "fuzzing" as const,
28+
mode: Mode.Fuzzing,
2729
runs: 32,
2830
seed: 1234,
2931
maxLen: 64,
@@ -308,7 +310,7 @@ describe("LibAFL runtime", () => {
308310
fuzzer.tracer.tracePcIndir(13, data.length);
309311
},
310312
{
311-
mode: "fuzzing",
313+
mode: Mode.Fuzzing,
312314
runs: 1,
313315
seed: 9,
314316
maxLen: 16,

packages/fuzzer/runtime/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
const { Mode } = require("../../options/dist/index.js");
1718
const { addon } = require("../dist/addon.js");
1819
const { fuzzer } = require("../dist/fuzzer.js");
1920

@@ -28,7 +29,7 @@ const libFuzzerArgs = [
2829
`-max_len=${maxLen}`,
2930
];
3031
const libAflOptions = {
31-
mode: "fuzzing",
32+
mode: Mode.Fuzzing,
3233
runs,
3334
seed,
3435
maxLen,

packages/options/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Mode = {
2323
export type Mode = (typeof Mode)[keyof typeof Mode];
2424

2525
export type LibAflOptions = {
26-
mode: "fuzzing" | "regression";
26+
mode: Mode;
2727
runs: number;
2828
seed: number;
2929
maxLen: number;

0 commit comments

Comments
 (0)