Mercurial > hg > xemacs-beta
changeset 5088:207dad9e74f7
Signal an error upon reading 1/0.
Thanks to Ben Wing for finding the problem. See xemacs-patches message with ID
<870180fe1003021239k77d81203xb7b6f94ce83208b3@mail.gmail.com> and also
<d7ba68911002240223u36bb87c2nf4ccfde06b5519cc@mail.gmail.com> in xemacs-beta.
author | Jerry James <james@xemacs.org> |
---|---|
date | Tue, 02 Mar 2010 13:42:37 -0700 |
parents | 818eeb72e0fb |
children | 99f8ebc082d9 cb4f2e1bacc4 |
files | src/ChangeLog src/lread.c |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Tue Mar 02 13:25:45 2010 -0700 +++ b/src/ChangeLog Tue Mar 02 13:42:37 2010 -0700 @@ -1,3 +1,8 @@ +2010-03-02 Jerry James <james@xemacs.org> + + * lread.c (read_atom): Signal a read error upon encountering a + ratio constant with a zero denominator. + 2010-03-02 Aidan Kehoe <kehoea@parhasard.net> * eval.c (print_multiple_value):
--- a/src/lread.c Tue Mar 02 13:25:45 2010 -0700 +++ b/src/lread.c Tue Mar 02 13:42:37 2010 -0700 @@ -1982,8 +1982,14 @@ if (*read_ptr == '+') read_ptr++; ratio_set_string (scratch_ratio, read_ptr, 0); - ratio_canonicalize (scratch_ratio); - return Fcanonicalize_number (make_ratio_rt (scratch_ratio)); + if (bignum_sign (ratio_denominator (scratch_ratio)) != 0) { + ratio_canonicalize (scratch_ratio); + return Fcanonicalize_number (make_ratio_rt (scratch_ratio)); + } + return Fsignal (Qinvalid_read_syntax, + list2 (build_msg_string + ("Invalid ratio constant in reader"), + make_string ((Ibyte *) read_ptr, len))); } #endif if (isfloat_string (read_ptr))