fuzz-tests: improve fuzz-bigsize#8301
Merged
rustyrussell merged 3 commits intoElementsProject:masterfrom Sep 15, 2025
Merged
Conversation
morehouse
reviewed
May 21, 2025
tests/fuzz/fuzz-bigsize.c
Outdated
| for (size_t i = 0; i < tal_count(wire_chunks); i++) { | ||
| wire_max = tal_count(wire_chunks[i]); | ||
| wire_ptr = wire_chunks[i]; | ||
| for (size_t max = 0; max <= BIGSIZE_MAX_LEN; max++) { |
Contributor
There was a problem hiding this comment.
max is unused, so what is the purpose of looping BIGSIZE_MAX_LEN times?
Author
There was a problem hiding this comment.
My bad, it should've been:
wire_chunks = get_chunks(NULL, data, size, max);
instead of:
wire_chunks = get_chunks(NULL, data, size, 8);
Changelog-None: The exisiting fuzz test only extracts chunks of a fixed size (8) from the fuzzer's input. Replace this with an iteration over a set of chunk sizes (1 to BIGSIZE_MAX_LEN) for better coverage. While at it, get rid of the check `if (bs != 0)` because 0 is a valid value for bigsize_t as well.
morehouse
approved these changes
Jun 7, 2025
Contributor
morehouse
left a comment
There was a problem hiding this comment.
While I'd prefer to simplify by removing the chunking entirely and setting an input max len of 8, that would completely change the existing corpus. Could still be done in the future.
tests/fuzz/fuzz-bigsize.c
Outdated
Comment on lines
+17
to
+18
| for (size_t max = 1; max <= BIGSIZE_MAX_LEN; max++) { | ||
| wire_chunks = get_chunks(NULL, data, size, max); |
Contributor
There was a problem hiding this comment.
Nit: chunk_size would be a more descriptive name
Suggested change
| for (size_t max = 1; max <= BIGSIZE_MAX_LEN; max++) { | |
| wire_chunks = get_chunks(NULL, data, size, max); | |
| for (size_t chunk_size = 1; chunk_size <= BIGSIZE_MAX_LEN; chunk_size++) { | |
| wire_chunks = get_chunks(NULL, data, size, chunk_size); |
added 2 commits
June 9, 2025 06:01
Add a roundtrip check for `bigsize_put()` using `bigsize_get()`. This enforces a stricter check for the former and adds a test for the latter, which is currently untested.
Improvements in the fuzz-testing scheme of fuzz-bigsize led to the discovery of test inputs that result in greater in code-coverage. Add these inputs to the test's seed corpus.
morehouse
approved these changes
Jun 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a couple of improvements to the fuzz test for
bigsize_toperations-tests/fuzz/fuzz-bigsize. Commit the newly discovered seed corpus inputs as well.Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:
CC: @morehouse