~ chicken-core (chicken-5) 42c869949f893baba40c9b0d5e4832eb2004b20e
commit 42c869949f893baba40c9b0d5e4832eb2004b20e
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Sun Dec 23 16:08:31 2012 +0100
Commit: Peter Bex <peter.bex@xs4all.nl>
CommitDate: Sun Dec 23 17:14:50 2012 +0100
Bugfix for foreign-argument-check routine for 64-bit unsigned longs. The function returned a raw floating-point value (coerced to C_word) instead of the original number.
Reported by Kon Lovett.
Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
diff --git a/runtime.c b/runtime.c
index f4babdff..7da117d5 100644
--- a/runtime.c
+++ b/runtime.c
@@ -5912,8 +5912,11 @@ C_regparm C_word C_fcall C_i_foreign_unsigned_integer64_argumentp(C_word x)
if((x & C_FIXNUM_BIT) != 0) return x;
- if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG)
- return C_flonum_magnitude(x);
+ if(!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG) {
+ m = C_flonum_magnitude(x);
+
+ if(m >= 0 && m <= C_UWORD_MAX) return x;
+ }
barf(C_BAD_ARGUMENT_TYPE_NO_UINTEGER_ERROR, NULL, x);
return C_SCHEME_UNDEFINED;
Trap