Skip to content

fuzz-tests: improve fuzz-bigsize #8301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Chand-ra
Copy link

@Chand-ra Chand-ra commented May 20, 2025

Add a couple of improvements to the fuzz test for bigsize_t operations-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:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.

CC: @morehouse

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++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max is unused, so what is the purpose of looping BIGSIZE_MAX_LEN times?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, it should've been:

wire_chunks = get_chunks(NULL, data, size, max);

instead of:

wire_chunks = get_chunks(NULL, data, size, 8);

Chandra Pratap added 3 commits May 22, 2025 04:56
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants