diff options
author | Paul Eggert <eggert@Penguin.CS.UCLA.EDU> | 2018-08-21 15:49:01 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-21 15:51:05 -0700 |
commit | f8069952abf147d090032ad6b941a728cad2c496 (patch) | |
tree | 44c5b5e6bbec09c14f5758fc6335c2e1fa207d76 /test/src/lread-tests.el | |
parent | f18af6cd5cb7dbbf7420ec2d3efed4e202c4f0dd (diff) | |
download | emacs-f8069952abf147d090032ad6b941a728cad2c496.tar.gz emacs-f8069952abf147d090032ad6b941a728cad2c496.tar.bz2 emacs-f8069952abf147d090032ad6b941a728cad2c496.zip |
Fix assertion failure when reading 'BIGNUM.'
Problem reported by Stefan Monnier (Bug#32476).
* src/lread.c (string_to_number): Don't pass leading "+"
or trailing "." or junk to make_bignum_str.
* test/src/lread-tests.el (lread-string-to-number-trailing-dot):
New test.
Diffstat (limited to 'test/src/lread-tests.el')
-rw-r--r-- | test/src/lread-tests.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 17381340c7b..f19d98320ab 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -209,4 +209,13 @@ literals (Bug#20852)." (should-error (let ((load-force-doc-strings t)) (read "#[0 \"\"]")))) +(ert-deftest lread-string-to-number-trailing-dot () + (dolist (n (list (* most-negative-fixnum most-negative-fixnum) + (1- most-negative-fixnum) most-negative-fixnum + (1+ most-negative-fixnum) -1 0 1 + (1- most-positive-fixnum) most-positive-fixnum + (1+ most-positive-fixnum) + (* most-positive-fixnum most-positive-fixnum))) + (should (= n (string-to-number (format "%d." n)))))) + ;;; lread-tests.el ends here |