Skip to content

Commit

Permalink
Merge pull request #326 from kevinbackhouse/fuzz-quadratic-brackets-o…
Browse files Browse the repository at this point in the history
…verflow

Fix bug in fuzz harness
  • Loading branch information
kevinbackhouse authored Apr 5, 2023
2 parents 2aad29d + f6e3ee1 commit ef63acf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fuzz/fuzz_quadratic_brackets.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
offset += fuzz_config.closelen;
}
memcpy(&markdown[markdown_size], &markdown0[offset],
endlen);
markdown_size += endlen;
if (markdown_size + endlen <= sizeof(markdown)) {
memcpy(&markdown[markdown_size], &markdown0[offset],
endlen);
markdown_size += endlen;
}
} else {
markdown_size = markdown_size0;
memcpy(markdown, markdown0, markdown_size);
Expand Down

0 comments on commit ef63acf

Please sign in to comment.