diff options
author | Brad King <brad.king@kitware.com> | 2016-11-29 13:28:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-11-29 13:30:25 (GMT) |
commit | 9e07ffa4e4211ca165f24c1f45744fbe7984a43f (patch) | |
tree | 8c5b9d849a9b460546ef2288e171bbc66a18c15a /Utilities | |
parent | d0ff3e701c63caab5a44c48ac70e3ab75af9ee88 (diff) | |
download | CMake-9e07ffa4e4211ca165f24c1f45744fbe7984a43f.zip CMake-9e07ffa4e4211ca165f24c1f45744fbe7984a43f.tar.gz CMake-9e07ffa4e4211ca165f24c1f45744fbe7984a43f.tar.bz2 |
librhash: Avoid signed left-shift overflow in sha256
Fix `rhash_sha256_final` to use unsigned integers for left shifting to
avoid the possibility of undefined overflow behavior.
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmlibrhash/librhash/sha256.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Utilities/cmlibrhash/librhash/sha256.c b/Utilities/cmlibrhash/librhash/sha256.c index 064dfe2..af5b0fe 100644 --- a/Utilities/cmlibrhash/librhash/sha256.c +++ b/Utilities/cmlibrhash/librhash/sha256.c @@ -218,8 +218,8 @@ void rhash_sha256_final(sha256_ctx *ctx, unsigned char* result) /* pad message and run for last block */ /* append the byte 0x80 to the message */ - ctx->message[index] &= le2me_32(~(0xFFFFFFFF << shift)); - ctx->message[index++] ^= le2me_32(0x80 << shift); + ctx->message[index] &= le2me_32(~(0xFFFFFFFFu << shift)); + ctx->message[index++] ^= le2me_32(0x80u << shift); /* if no room left in the message to store 64-bit message length */ if (index > 14) { |