mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Fix md5 calculaton on blocks larger then 2^32. Bug reproduced and debugged by Serge Belyshev. Patch by Paul Eggert.
This commit is contained in:
parent
a9ba55fe61
commit
9430b6ff4a
6
md5.c
6
md5.c
|
|
@ -322,13 +322,13 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||||
uint32_t B = ctx->B;
|
uint32_t B = ctx->B;
|
||||||
uint32_t C = ctx->C;
|
uint32_t C = ctx->C;
|
||||||
uint32_t D = ctx->D;
|
uint32_t D = ctx->D;
|
||||||
|
uint32_t lolen = len;
|
||||||
|
|
||||||
/* First increment the byte count. RFC 1321 specifies the possible
|
/* First increment the byte count. RFC 1321 specifies the possible
|
||||||
length of the file up to 2^64 bits. Here we only compute the
|
length of the file up to 2^64 bits. Here we only compute the
|
||||||
number of bytes. Do a double word increment. */
|
number of bytes. Do a double word increment. */
|
||||||
ctx->total[0] += len;
|
ctx->total[0] += lolen;
|
||||||
if (ctx->total[0] < len)
|
ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
|
||||||
++ctx->total[1];
|
|
||||||
|
|
||||||
/* Process all bytes in the buffer with 64 bytes in each round of
|
/* Process all bytes in the buffer with 64 bytes in each round of
|
||||||
the loop. */
|
the loop. */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue