Skip to content

Commit

Permalink
fuzzing: updated JSON target
Browse files Browse the repository at this point in the history
Added 'nxt_conf_json_length' check for extra coverage.
  • Loading branch information
pkillarjun committed Aug 2, 2024
1 parent 7ea40a1 commit d261278
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions fuzzing/nxt_json_fuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ LLVMFuzzerInitialize(int *argc, char ***argv)
int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
nxt_mp_t *mp;
nxt_str_t input;
nxt_thread_t *thr;
nxt_runtime_t *rt;
nxt_conf_value_t *conf;
nxt_conf_validation_t vldt;
nxt_mp_t *mp;
nxt_str_t input;
nxt_thread_t *thr;
nxt_runtime_t *rt;
nxt_conf_value_t *conf;
nxt_conf_validation_t vldt;
nxt_conf_json_pretty_t pretty;

if (size < KMININPUTLENGTH || size > KMAXINPUTLENGTH) {
return 0;
Expand Down Expand Up @@ -65,6 +66,11 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
goto failed;
}

nxt_memzero(&pretty, sizeof(nxt_conf_json_pretty_t));

nxt_conf_json_length(conf, NULL);
nxt_conf_json_length(conf, &pretty);

nxt_memzero(&vldt, sizeof(nxt_conf_validation_t));

vldt.pool = nxt_mp_create(1024, 128, 256, 32);
Expand Down

0 comments on commit d261278

Please sign in to comment.