Fix user supplied witness version check in bech32Encode function#102147
Conversation
|
The |
Algunenano
left a comment
There was a problem hiding this comment.
Looks good, but it should either be "Not for changelog" (I don't see this as a real bug), or we need to add/update a tests to reflect the change
I changed it to "Not for changelog" |
| * It also must fit in the bech32 charset which is 5 bits (0-31), otherwise | ||
| * indexing into the CHARSET array in bech32::encode will cause a buffer overflow. | ||
| */ | ||
| auto user_witness_version = witness_version_col->getUInt(i); |
There was a problem hiding this comment.
static_cast<uint8_t>, but we still need a regression test for wider unsigned input types (allowed by isNativeUInt()), e.g. toUInt16(272) or toUInt64(1000).
Without this, the previous truncation bug path is not fully protected against refactors (values >255 being truncated before validation). Please add a stateless query test that passes a wider UInt type and asserts BAD_ARGUMENTS.
LLVM Coverage Report
Changed lines: 100.00% (17/17) | lost baseline coverage: 1 line(s) · Uncovered code |

Fix user supplied witness version value check. Resolves #101839.
Changelog category (leave one):