#776236 scheme48: number->string fails when given invalid radix 1 (one)

Package:
scheme48
Source:
scheme48
Description:
simple, modular, and lightweight Scheme implementation
Submitter:
Date:
2024-08-18 11:33:01 UTC
Severity:
normal
Tags:
#776236#5
Date:
2015-01-25 20:09:35 UTC
From:
To:
Package: scheme48
Version: 1.9-5
 
number->string doesn't seem to handle being passed the (invalid) radix 1 (one) very well.
(I would expect an invalid-argument error)
 
interrupt: insufficient memory after major GC [command-level-event-handler] post-major-gc

#776236#10
Date:
2020-12-07 18:15:14 UTC
From:
To:
Patch to fix this (by treating radix value 1 as invalid) attached.
You need to rerun "make image" for it to take effect.

Note that according to the specification of number->string in
r[567]rs, the only acceptable radix values are 2, 8, 10, and 16.

(But other scheme implementations are also more tolerant, e.g. Guile
allows 2..36)
--- a/scheme/rts/numio.scm
+++ b/scheme/rts/numio.scm
@@ -17,7 +17,7 @@
 		 (and (null? (cdr maybe-radix))
 		      (integer? radix)
 		      (exact? radix)
-		      (< 0 radix))))
+		      (<= 2 radix))))
 	(real-number->string number radix)
 	(apply assertion-violation
 	       'number->string

#776236#17
Date:
2024-08-18 10:43:44 UTC
From:
To:
Hi Richard,

thanks a lot for the patch, unfortunately it does not seem to work:

thorsten@sid:~$ dpkg -l scheme48
ii  scheme48       1.9.2-3      amd64        simple, modular, and lightweight Scheme implementation
thorsten@sid:~$ scheme48
Welcome to Scheme 48 1.9.2 (made by x86-csail-01 on 2024-07-28)
See http://s48.org/ for more information.
Please report bugs to scheme-48-bugs@s48.org.
Get more information at http://www.s48.org/.
Type ,? (comma question-mark) for help.
gc: Scheme 48 heap overflow (max heap size 4000000 cells)

Abgebrochen



thorsten@sid:~$ dpkg -l scheme48
ii  scheme48       1.9.2-4      amd64        simple, modular, and
lightweight Scheme implementation
thorsten@sid:~$ scheme48
Welcome to Scheme 48 1.9.2 (made by builder4-extern on 2024-08-18)
See http://s48.org/ for more information.
Please report bugs to scheme-48-bugs@s48.org.
Get more information at http://www.s48.org/.
Type ,? (comma question-mark) for help.
gc: Scheme 48 heap overflow (max heap size 4000000 cells)

Abgebrochen
thorsten@sid:~$