com php-src: Change Big Endian backup implementations to use signed indexes: ext/hash/hash_sha3.c

From: Date: Tue, 01 Nov 2016 16:35:54 +0000
Subject: com php-src: Change Big Endian backup implementations to use signed indexes: ext/hash/hash_sha3.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95377@lists.php.net to get a copy of this message
Commit: 65d7bbaddcb7d039d201b0c0cd452736fd326c73 Author: Sara Golemon <pollita@php.net> Tue, 11 Oct 2016 20:43:02 -0700 Parents: a5458e7e8e22c8f58a00cd649c8a55a93ba1e625 Branches: PHP-7.1 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=65d7bbaddcb7d039d201b0c0cd452736fd326c73 Log: Change Big Endian backup implementations to use signed indexes load64() counted down from 7..0, but the decrement turned 0 into 255. This means the loop would never terminate on Big Endian systems. Just use signed char integers since we're only dealing with values from 0..7 anyway. Closes https://bugs.php.net/bug.php?id=73282 Changed paths: M ext/hash/hash_sha3.c Diff: diff --git a/ext/hash/hash_sha3.c b/ext/hash/hash_sha3.c index 8f18fa1..b03c1f9 100644 --- a/ext/hash/hash_sha3.c +++ b/ext/hash/hash_sha3.c @@ -38,7 +38,7 @@ static inline unsigned char idx(unsigned char x, unsigned char y) { #ifdef WORDS_BIGENDIAN static inline uint64_t load64(const unsigned char* x) { - unsigned char i; + char i; uint64_t ret = 0; for (i = 7; i >= 0; --i) { ret <<= 8; @@ -47,14 +47,14 @@ static inline uint64_t load64(const unsigned char* x) { return ret; } static inline void store64(unsigned char* x, uint64_t val) { - unsigned char i; + char i; for (i = 0; i < 8; ++i) { x[i] = val & 0xFF; val >>= 8; } } static inline void xor64(unsigned char* x, uint64_t val) { - unsigned char i; + char i; for (i = 0; i < 8; ++i) { x[i] ^= val & 0xFF; val >>= 8;

« previous php.cvs (#95377) next »