diff options
author | Emilia Kasper <emilia@openssl.org> | 2015-03-13 21:10:13 -0700 |
---|---|---|
committer | Emilia Kasper <emilia@openssl.org> | 2015-03-13 21:14:56 -0700 |
commit | a2fcab9978a0905c4286051993da63329fda8a19 (patch) | |
tree | 1ba8152acb8171fde5e8c0b14be933b1efd8329f /apps/ca.c | |
parent | 1a098164354e8e14e0237993cca7a0bffe820ed6 (diff) | |
download | openssl-new-a2fcab9978a0905c4286051993da63329fda8a19.tar.gz |
Fix undefined behaviour in shifts.
Td4 and Te4 are arrays of u8. A u8 << int promotes the u8 to an int first then shifts.
If the mathematical result of a shift (as modelled by lhs * 2^{rhs}) is not representable
in an integer, behaviour is undefined. In other words, you can't shift into the sign bit
of a signed integer. Fix this by casting to u32 whenever we're shifting left by 24.
(For consistency, cast other shifts, too.)
Caught by -fsanitize=shift
Submitted by Nick Lewycky (Google)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 8b37e5c14f0eddb10c7f91ef91004622d90ef361)
Diffstat (limited to 'apps/ca.c')
0 files changed, 0 insertions, 0 deletions