Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #1194: Ensure safety of ctz_debruijn implementation.
d6ff738 Ensure safety of ctz_debruijn implementation. (Russell O'Connor) Pull request description: Adding `U` to the magic constants ensures that we are not mixing unsigned and signed value during multiplication, and ensures that the multiplication will not be subject to integer promotion. The `(uint32_t)`/`(uint64_t)` casts ensure the values are properly truncated no matter the size of an int. Prior to this commit, if `secp256k1_ctz32_var_debruijn` were some how managed to be built on a platform with 64-bit ints, (though this function is specifically only intended to be used on 32-bit platforms) it would perform an out-of-bounds array access. ACKs for top commit: real-or-random: utACK d6ff738 apoelstra: ACK d6ff738 Tree-SHA512: f2292fa6e03deff4598514f9070b1357ce307ce1d2b34c15da120198c2f9171dfae9e0aaddb99f2c577ec368a903337eb68281518e93e43c381c9875aa84144e
- Loading branch information