#163 closed defect (fixed)
sha2 digest procedures break when attempt to encode #f
Reported by: | Mario Domenech Goulart | Owned by: | daishi |
---|---|---|---|
Priority: | critical | Milestone: | 4.5.0 |
Component: | extensions | Version: | 4.3.x |
Keywords: | sha2 | Cc: | |
Estimated difficulty: |
Description
~$ /usr/local/chicken-4.3.0/bin/csi -n CHICKEN (c)2008-2009 The Chicken Team (c)2000-2007 Felix L. Winkelmann Version 4.3.0 linux-unix-gnu-x86 [ manyargs dload ptables ] compiled 2009-12-15 on dellito (Linux) #;1> (use sha2) ; loading /usr/local/chicken-4.3.0/lib/chicken/4/sha2.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/chicken.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/scheme.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/foreign.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/message-digest.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/lolevel.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/srfi-1.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/srfi-4.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/srfi-13.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/srfi-69.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/miscmacros.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/type-checks.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/type-errors.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/data-structures.import.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/sha2.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/message-digest.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/type-checks.so ... ; loading /usr/local/chicken-4.3.0/lib/chicken/4/type-errors.so ... #;2> (sha256-digest #f) csi: sha2-base.c:536: SHA256_Update: Assertion `context != (SHA256_CTX*)0 && data != (sha2_byte*)0' failed. Aborted
The same behavior has been observed for sha384-digest
and {{sha512-digest}}}. They make the interpreter abort.
Attachments (1)
Change History (5)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Milestone: | → 4.5.0 |
---|---|
Owner: | set to daishi |
Status: | new → assigned |
I've attached a patch which implements a (maybe crude) fix. Basically, all the exported procedures which expect an argument check if it is a string. If it is not a string, raise an error indicating that an string is expected.
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I've contacted Daishi and he said the patch looks ok. He asked me to apply it. So I did it and released version 2.0.1.
comment:4 Changed 15 years ago by
Unfortunately this breaks the ability of sha2 to digest any object other than strings such as blobs, srfi-4 vectors and even user-defined objects.
Fixed the underlying problem in message-digest 2.0.3, which was that a length of -1 was being returned to digest procedures that didn't expect it, causing a segfault. Now it signals an error. So sha2 can safely digest any object again.
Milestone 4.4.0 deleted