fuzz-tests: Test over all possible witness version values
What changed, and why it matters
This commit only changes a fuzz test file. Fuzz tests are automated security exercises that throw random inputs at code to find bugs. The change expands the test to loop through all valid SegWit witness program versions (0 to 16) instead of just versions 0 and 1. It does not modify any production code, so it cannot by itself introduce or fix a vulnerability in the running software.
No security action required. Treat as a normal test-coverage improvement. If reviewing for release, verify that the fuzzer still builds and runs, and consider whether the expanded version range exposes any latent crashes in segwit_addr_encode that should be investigated separately.
Security signals we found
No production code changed
Change is confined to a fuzz test harness
No input validation, parsing, or cryptographic logic modified
No memory safety, resource handling, or authorization changes
Evidence from the diff
The diff modifies tests/fuzz/fuzz-bech32.c, changing the loop bound in the fuzz test from wit_version < 2 to wit_version <= 16. This aligns the fuzzer with the documented valid witness version range in common/bech32.h (0-16 inclusive). No library, protocol, or runtime code is changed. There is no patch to a security bug; this is purely a test-coverage improvement.
Changed components
tests/fuzz/fuzz-bech32.cInspect captured patch +1 / −1
diff --git a/tests/fuzz/fuzz-bech32.c b/tests/fuzz/fuzz-bech32.c
index beda53be..6d6b346f 100644
--- a/tests/fuzz/fuzz-bech32.c
+++ b/tests/fuzz/fuzz-bech32.c
@@ -48,7 +48,7 @@ void run(const uint8_t *data, size_t size)
bech32_convert_bits(data_out, &data_out_len, 8, data, size, 5, 0);
addr = tal_arr(tmpctx, char, 73 + strlen(hrp_addr));
- for (int wit_version = 0; wit_version < 2; ++wit_version) {
+ for (int wit_version = 0; wit_version <= 16; ++wit_version) {
if (segwit_addr_encode(addr, hrp_addr, wit_version, data,
size) == 0)
continue;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.