code-intelligence.com/cifuzz@v0.40.0/examples/bazel/README.md (about)

     1  # cifuzz bazel example
     2  
     3  This is a simple bazel based project, already configured with
     4  **cifuzz**. It should quickly produce a finding, but slow enough to
     5  see the progress of the fuzzer.
     6  
     7  To start make sure you installed **cifuzz** according to the
     8  main [README](../../README.md).
     9  
    10  You can start the fuzzing with
    11  
    12  ```bash
    13  cifuzz run //src:explore_me_fuzz_test
    14  ```
    15  
    16  ## Create regression test
    17  
    18  After you have discovered a finding, you may want to include this as
    19  part of a regression test. To replay findings from the
    20  `src/explore_me_fuzz_test_inputs` directory:
    21  
    22  ```bash
    23  bazel test --config=cifuzz-replay //src:explore_me_fuzz_test --test_output=streamed
    24  ```
    25  
    26  Note that this requires these lines in your `.bazelrc`:
    27  
    28  ```bash
    29  # Replay cifuzz findings (C/C++ only)
    30  build:cifuzz-replay --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan
    31  build:cifuzz-replay --@rules_fuzzing//fuzzing:cc_engine_sanitizer=ubsan
    32  build:cifuzz-replay --compilation_mode=opt
    33  build:cifuzz-replay --copt=-g
    34  build:cifuzz-replay --copt=-U_FORTIFY_SOURCE
    35  build:cifuzz-replay --test_env=UBSAN_OPTIONS=halt_on_error=1
    36  ```