Skip to content

Commit

Permalink
fuzzer: Add seed argument for fsm_generate_matches (interface change).
Browse files Browse the repository at this point in the history
  • Loading branch information
silentbicycle committed Oct 10, 2024
1 parent 98e9cb4 commit 23e6142
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fuzz/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ fuzz_eager_output(const uint8_t *data, size_t size)

size_t max_pattern_length = 0;

const unsigned seed = size == 0 ? 0 : data[0];

/* chop data into a series of patterns */
{
size_t prev = 0;
Expand Down Expand Up @@ -645,7 +647,7 @@ fuzz_eager_output(const uint8_t *data, size_t size)
* Use the combined DFA to generate matches, check that the
* match behavior agrees with the individual DFA copies. */
env.current_pattern = (size_t)-1;
if (!fsm_generate_matches(env.combined, max_pattern_length, gen_combined_check_individual_cb, &env)) {
if (!fsm_generate_matches(env.combined, max_pattern_length, seed, gen_combined_check_individual_cb, &env)) {
goto cleanup;
}

Expand All @@ -655,7 +657,7 @@ fuzz_eager_output(const uint8_t *data, size_t size)
/* check behavior against the combined DFA. */
for (size_t i = 0; i < env.pattern_count; i++) {
env.current_pattern = i;
if (!fsm_generate_matches(env.combined, max_pattern_length, gen_individual_check_combined_cb, &env)) {
if (!fsm_generate_matches(env.combined, max_pattern_length, seed, gen_individual_check_combined_cb, &env)) {
goto cleanup;
}
}
Expand Down

0 comments on commit 23e6142

Please sign in to comment.