From e8030d7eb780952d6f407abf7c3f85f16b161320 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Fri, 5 Feb 2010 13:27:04 +0900 Subject: [PATCH] fixing bug when reading invalid "." in non-decimal bignums (issue 32) --- opt/bignum.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opt/bignum.c b/opt/bignum.c index 835b354f..61bde456 100644 --- a/opt/bignum.c +++ b/opt/bignum.c @@ -225,8 +225,10 @@ sexp sexp_read_bignum (sexp ctx, sexp in, sexp_uint_t init, if (c=='.' || c=='e' || c=='E') { if (base != 10) res = sexp_read_error(ctx, "found non-base 10 float", SEXP_NULL, in); - if (c!='.') sexp_push_char(ctx, c, in); - res = sexp_read_float_tail(ctx, in, sexp_bignum_to_double(res), (sign==-1)); + else { + if (c!='.') sexp_push_char(ctx, c, in); /* push the e back */ + res = sexp_read_float_tail(ctx, in, sexp_bignum_to_double(res), (sign==-1)); + } } else if ((c!=EOF) && ! is_separator(c)) { res = sexp_read_error(ctx, "invalid numeric syntax", sexp_make_character(c), in);