Summary
"Snowdigest" egg causes stack overflow error in tests with experimental
Metadata
- Id: 98d6f5e9ba3d6dbdb1842ac68b9ea2f7f2bb0c39
- Trac id: 531
- Type: defect
- Reporter: sjamaan
- Owner: felix
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: critical
- Milestone: 4.9.0
- Version: 4.6.x
- Changetime: 2012-09-24 21:47:48 UTC
- Created: 2011-03-15 19:33:17 UTC
- Keywords: stack overflow
Description
$ /home/sjamaan/chicken-test/bin/csi -s run.scm
00000000
e8b7be43
352441c2
4c2750bd
1fc2e6d2
7ca94a72
d41d8cd98f00b204e9800998ecf8427e
0cc175b9c0f1b6a831c399e269772661
900150983cd24fb0d6963f7d28e17f72
Error: stack overflow
Call history:
<eval> [t] (print md)
<eval> [t] (string-ci=? md expect)
<eval> [t] (car v)
<eval> [t] (cadr v)
<eval> [t] (caddr v)
<eval> [t] (cadddr v)
<eval> [t] (= repeat 0)
<eval> [t] (digest-string str2 algorithm (quote hex))
<eval> [t] (print md)
<eval> [t] (string-ci=? md expect)
<eval> [t] (car v)
<eval> [t] (cadr v)
<eval> [t] (caddr v)
<eval> [t] (cadddr v)
<eval> [t] (= repeat 0)
<eval> [t] (digest-string str2 algorithm (quote hex)) <--
This happened on NetBSD/amd64 with experimental (4.6.6). Doesn't happen under 4.6.0
I tagged it as a "core libraries" error, since I assume it's a bug in Chicken, not snowdigest.
Changes and comments
[2011-03-31 12:34:13 UTC] felix changed status from new to closed
[2011-03-31 12:34:13 UTC] felix set resolution to fixed
[2011-03-31 12:34:13 UTC] felix wrote:
The problem appears to be that the internal calculation-routines in snowdigest are optimized into non-CPS "direct" calls (this code is very tight and does lots of fixnum-arithmetic). It is also recursive, so, depending on initial stack size, it may happen that the recursive direct-style part is running while the stack is already relatively near to the limit (i.e. shortly before CPS-code would trigger a minor GC). I have raised the size of the "reserve" area on the stack for this situation (it was 4096 bytes before, now it's 64k).
There also was a problem with garbage bits in character values for which the internal comparison routines didn't work correctly.
See "experimental" branch for the fix. The char-comparison change will only propagate by compiling the compiler with itself and then rebuilding.
[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0
[2011-06-01 09:00:41 UTC] felix wrote:
Milestone 4.7.0 deleted
[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0
[2012-09-24 21:47:48 UTC] felix wrote:
Milestone 4.8.0 deleted