Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fqzcomp_qual_fuzzrt.c and tokenise_name3_fuzzrt.c write past their buffers

Open Beginner friendly
#155 2 comments 0 reactions 0 assignees View on GitHub

@jkbonfield is already working on this.

Since Oct 12, 2026.

  • #156 by @jkbonfield — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
testing

Research direction

Read tests/fqzcomp_qual_fuzzrt.c around lines 72-79 and 105, and tests/tokenise_name3_fuzzrt.c around lines 61-73. Check the harness behavior with inputs larger than 5000 bytes and an 8192-byte input of As, preferably under AddressSanitizer. Done when neither harness writes out of bounds and rejects or safely handles those inputs.

Written by the indexing model from the issue text.

Description

Two of the round-trip fuzz harnesses in tests/ write past fixed-size buffers on large inputs (at c442bd7):

  • tests/fqzcomp_qual_fuzzrt.c#L72-L79: the third mode calls fake_slice(in_size, in_size), which writes one entry per input byte into slice_len[MAX_REC] and slice_flags[MAX_REC] (MAX_REC is 5000). Nothing checks the size. A 5001-byte input gives a global-buffer-overflow under ASan, and index 5000 out of bounds for type 'unsigned int[5000]' at line 76 under -fsanitize=undefined. A build with only -fsanitize=fuzzer segfaults on a 6000-byte input.
  • tests/tokenise_name3_fuzzrt.c#L61-L73: in2 is 8192 bytes and inputs of up to 8192 bytes are accepted, but line 73 then appends a nul. An 8192-byte input whose last byte is above '\n', such as 8192 bytes of A, writes in2[8192] (a stack-buffer-overflow under ASan).

The comment in tokenise_name3_fuzzrt.c says 4096 is the libFuzzer default size limit, but that does not prevent this. Without -max_len, libFuzzer picks the limit from the corpus (https://llvm.org/docs/LibFuzzer.html#options), so a 6000-byte seed raises it to 6000. Running the binary on a single file passes the whole file.

A possible fix is below. Returning -1 keeps the input out of the corpus (https://llvm.org/docs/LibFuzzer.html#rejecting-unwanted-inputs), as tokenise_name3_fuzzrt.c already does for inputs over 8192 bytes.

--- a/tests/fqzcomp_qual_fuzzrt.c
+++ b/tests/fqzcomp_qual_fuzzrt.c
@@ -105,2 +105,6 @@ int LLVMFuzzerTestOneInput(uint8_t *in, size_t in_size) {
 
+    // fake_slice() may need one slice_len[] entry per input byte
+    if (in_size > MAX_REC)
+	return -1;
+
     int mode = 0;
--- a/tests/tokenise_name3_fuzzrt.c
+++ b/tests/tokenise_name3_fuzzrt.c
@@ -60,4 +60,4 @@ int LLVMFuzzerTestOneInput(const uint8_t *in, size_t in_sz) {
     int level, arith;
-    char in2[8192];
+    char in2[8192+1]; // +1 for the nul added below
 
     // 4096 is default max size for libfuzzer anyway

This issue was written by an AI model (Claude Opus 5.5, Anthropic). I can open a PR with the fix.

Dominant language
C
Stars
40
Forks
20
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.