mirror of
https://github.com/git/git.git
synced 2024-10-28 21:07:52 +01:00
Fix PPC SHA1 routine for large input buffers
The PPC SHA1 routine had an overflow which meant that it gave incorrect results for input buffers >= 512MB. This fixes it by ensuring that the update of the total length in bits is done using 64-bit arithmetic. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
476a4dfc05
commit
b47f509ba5
1 changed files with 1 additions and 1 deletions
|
@ -30,7 +30,7 @@ int SHA1_Update(SHA_CTX *c, const void *ptr, unsigned long n)
|
||||||
unsigned long nb;
|
unsigned long nb;
|
||||||
const unsigned char *p = ptr;
|
const unsigned char *p = ptr;
|
||||||
|
|
||||||
c->len += n << 3;
|
c->len += (uint64_t) n << 3;
|
||||||
while (n != 0) {
|
while (n != 0) {
|
||||||
if (c->cnt || n < 64) {
|
if (c->cnt || n < 64) {
|
||||||
nb = 64 - c->cnt;
|
nb = 64 - c->cnt;
|
||||||
|
|
Loading…
Reference in a new issue