diff options
author | Pauli <pauli@openssl.org> | 2022-03-16 14:13:25 +1100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-03-25 17:32:44 +1100 |
commit | 00e5603de13e4f436a0f07abed28b7ea8e3a236e (patch) | |
tree | 079fd34d0a9248ff550e56b8d584ff0127b51706 /crypto/ec | |
parent | eed53b9addd097a5d39f896b05aa857d6f29b245 (diff) |
Fix Coverity 1498612: integer overflow
The assert added cannot ever fail because (current & 0xFFFF) != 0 from the
while loop and the trailing zero bit count therefore cannot be as large as 32.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/17892)
(cherry picked from commit 81487b65b9eb8148471e729b8c1959521d62c69e)
Diffstat (limited to 'crypto/ec')
-rw-r--r-- | crypto/ec/curve448/curve448.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/ec/curve448/curve448.c b/crypto/ec/curve448/curve448.c index 12d97f0679..3aff980209 100644 --- a/crypto/ec/curve448/curve448.c +++ b/crypto/ec/curve448/curve448.c @@ -577,6 +577,7 @@ static int recode_wnaf(struct smvt_control *control, int32_t delta = odd & mask; assert(position >= 0); + assert(pos < 32); /* can't fail since current & 0xFFFF != 0 */ if (odd & (1 << (table_bits + 1))) delta -= (1 << (table_bits + 1)); current -= delta * (1 << pos); |