Fix hash computation when importing NARs greater than 4 GiB
This caused "nix-store --import" to compute an incorrect hash on NARs
that don't fit in an unsigned int. The import would succeed, but
"nix-store --verify-path" or subsequent exports would detect an
incorrect hash.
A deeper issue is that the export/import format does not contain a
hash, so we can't detect such issues early.
Also, I learned that -Wall does not warn about this.
(cherry picked from commit 41c4558afe
)
This commit is contained in:
parent
5d59ec86d4
commit
26f7e8305b
|
@ -205,7 +205,7 @@ static void start(HashType ht, Ctx & ctx)
|
|||
|
||||
|
||||
static void update(HashType ht, Ctx & ctx,
|
||||
const unsigned char * bytes, unsigned int len)
|
||||
const unsigned char * bytes, size_t len)
|
||||
{
|
||||
if (ht == htMD5) MD5_Update(&ctx.md5, bytes, len);
|
||||
else if (ht == htSHA1) SHA1_Update(&ctx.sha1, bytes, len);
|
||||
|
|
Loading…
Reference in New Issue