When a region greater than 128 bits is loaded into a u128 via the load_be bitvec method, a panic will occur due to a check in the bitvec library. This can occur in the decode_bits_as_integer hampi method when a bit length greater than 128 is passed into it, which in turn happens in the decode_unconstrained_whole_number_common method. To ensure this crash cannot happen due to parsing unconstrained ASN.1 input, I've made a change that returns an error instead of crashing.
Additionally, this pull request fixes an implicit u128 to i128 conversion error when values are greater than i128::MAX; I've also changed this so that the value returns an error instead of crashing.
When a region greater than 128 bits is loaded into a
u128
via theload_be
bitvec method, a panic will occur due to a check in the bitvec library. This can occur in thedecode_bits_as_integer
hampi method when a bit length greater than 128 is passed into it, which in turn happens in thedecode_unconstrained_whole_number_common
method. To ensure this crash cannot happen due to parsing unconstrained ASN.1 input, I've made a change that returns an error instead of crashing.Additionally, this pull request fixes an implicit u128 to i128 conversion error when values are greater than i128::MAX; I've also changed this so that the value returns an error instead of crashing.