[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] possible bug in simple-sha1
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] possible bug in simple-sha1 |
Date: |
Sun, 2 Jun 2019 13:01:41 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Sun, Jun 02, 2019 at 12:39:25PM +0200, Kristian Lein-Mathisen wrote:
> Hi guys,
>
> I've come across a strange problem with simple-sha1. Sometimes it reports
> the wrong hash for large files when I use the sha1sum procedure. I don't
> know if the problem is there for strings.
>
> 1216 address@hidden ~/archive ➤ csi -R simple-sha1 -p '(sha1sum
> "MOV_0384.mp4")'
> ; sha1sum "MOV_0384.mp4"
> cb491b2f692dc3e9269a633f54eceb85269b0442
> 3b673158654ddc9bb668b5eafc050c8be66ad968
> ./xz2/dcim/phone/100ANDRO/MOV_0384.mp4
>
> >From not-very-rigorous testing, it seems it happens on all files that are
> bigger than the 512M mark:
This just screams "overflow"; (integer-length (* 512 1024 1024) => 30
Are you using CHICKEN 4 or CHICKEN 5?
Even CHICKEN 4 should deal with this correctly by overflowing into a
flonum. That would be a bug in the egg, then.
Perhaps the fix is changing:
(define update (foreign-lambda void "SHA1Update" c-pointer c-pointer int))
into:
(define update (foreign-lambda void "SHA1Update" c-pointer c-pointer integer))
Can you try?
Cheers,
Peter
signature.asc
Description: PGP signature