aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Stephani2016-12-10 15:36:11 +0100
committerPhilipp Stephani2016-12-23 13:21:34 +0100
commit6eaadcc7c821b7a8c75ce6d1d56cd7f50898f809 (patch)
tree48b8099a287a9a16387e8be86d00aac7406cec6a
parent831bef1a469356b82892c163f33c9c65ccd75c7c (diff)
downloademacs-6eaadcc7c821b7a8c75ce6d1d56cd7f50898f809.tar.gz
emacs-6eaadcc7c821b7a8c75ce6d1d56cd7f50898f809.zip
Treat incomplete integer literals as errors
See Bug#25120. * src/lread.c (read_integer): Treat incomplete integer literals as errors. * test/src/lread-tests.el (lread-empty-int-literal): New unit test for incomplete integer literals.
-rw-r--r--src/lread.c2
-rw-r--r--test/src/lread-tests.el8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/lread.c b/src/lread.c
index fdbf0329118..35348f1ddb8 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2536,7 +2536,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
2536 *p = '\0'; 2536 *p = '\0';
2537 } 2537 }
2538 2538
2539 if (! valid) 2539 if (valid != 1)
2540 { 2540 {
2541 sprintf (buf, "integer, radix %"pI"d", radix); 2541 sprintf (buf, "integer, radix %"pI"d", radix);
2542 invalid_syntax (buf); 2542 invalid_syntax (buf);
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 1a82d133a44..609f82ec20b 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -104,4 +104,12 @@
104(ert-deftest lread-string-char-name () 104(ert-deftest lread-string-char-name ()
105 (should (equal (read "\"a\\N{SYLOTI NAGRI LETTER DHO}b\"") "a\uA817b"))) 105 (should (equal (read "\"a\\N{SYLOTI NAGRI LETTER DHO}b\"") "a\uA817b")))
106 106
107(ert-deftest lread-empty-int-literal ()
108 "Check that Bug#25120 is fixed."
109 (should-error (read "#b") :type 'invalid-read-syntax)
110 (should-error (read "#o") :type 'invalid-read-syntax)
111 (should-error (read "#x") :type 'invalid-read-syntax)
112 (should-error (read "#24r") :type 'invalid-read-syntax)
113 (should-error (read "#") :type 'invalid-read-syntax))
114
107;;; lread-tests.el ends here 115;;; lread-tests.el ends here