[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] bugfix for C_i_foreign_unsigned_integer64_argu
From: |
Felix |
Subject: |
[Chicken-hackers] [PATCH] bugfix for C_i_foreign_unsigned_integer64_argumentp |
Date: |
Sun, 23 Dec 2012 16:15:58 +0100 (CET) |
The attached patch fixes a bug in an argument type test routine for
foreign code invocations. This was reported by Kon Lovett and should
fix #955.
cheers,
felix
>From 5b5ce9976ab25fb215cdb264055d838af6f271fe Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Sun, 23 Dec 2012 16:08:31 +0100
Subject: [PATCH] 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.
---
runtime.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/runtime.c b/runtime.c
index f4babdf..7da117d 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;
--
1.7.0.4
- [Chicken-hackers] [PATCH] bugfix for C_i_foreign_unsigned_integer64_argumentp,
Felix <=