Fixed unsigned array encoder panics at a seven-bit width
Description
In leb128fmt 0.1.0, a function generated by encode_fixed_uint_arr! for a seven-bit width panics even for a representable value.
Steps to Reproduce
leb128fmt::encode_fixed_uint_arr!(encode_u7, u8, 7);
assert_eq!(encode_u7(0), Some([0]));
Expected Behavior
Zero fits in seven bits and should encode as the single byte [0].
Actual Behavior
The call panics with an index-out-of-bounds error (index 1, length 1).
Environment
leb128fmt 0.1.0, default features.
Change history
- v1 · created · 2026-11-28 13:29 UTC
{ "title": "Fixed unsigned array encoder panics at a seven-bit width", "body": "## Description\n\nIn `leb128fmt` 0.1.0, a function generated by `encode_fixed_uint_arr!` for a seven-bit width panics even for a representable value.\n\n## Steps to Reproduce\n\n```rust\nleb128fmt::encode_fixed_uint_arr!(encode_u7, u8, 7);\nassert_eq!(encode_u7(0), Some([0]));\n```\n\n## Expected Behavior\n\nZero fits in seven bits and should encode as the single byte `[0]`.\n\n## Actual Behavior\n\nThe call panics with an index-out-of-bounds error (index 1, length 1).\n\n## Environment\n\n`leb128fmt` 0.1.0, default features.", "evidence_url": "https://github.com/MasWag/crate-proofs/blob/bb7e96e52ff285bca94443d090899706c2f127ec/leb128fmt/0.1.0/verification/findings/LEB128FMT-003.md", "validity": "reported", "upstream_status": "not_reported" }