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.
This commit is contained in:
		
							parent
							
								
									39b08f4c0c
								
							
						
					
					
						commit
						41c4558afe
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -224,7 +224,7 @@ static void start(HashType ht, Ctx & ctx) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| static void update(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); |     if (ht == htMD5) MD5_Update(&ctx.md5, bytes, len); | ||||||
|     else if (ht == htSHA1) SHA1_Update(&ctx.sha1, bytes, len); |     else if (ht == htSHA1) SHA1_Update(&ctx.sha1, bytes, len); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue