From 2055147b4de79503f387fdb65d3559f99249353b Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 10 Dec 2016 15:36:11 +0100 Subject: [PATCH 1/1] 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. --- src/lread.c | 2 +- test/src/lread-tests.el | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lread.c b/src/lread.c index 157a392..5e1c61c 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2536,7 +2536,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) *p = '\0'; } - if (! valid) + if (valid != 1) { sprintf (buf, "integer, radix %"pI"d", radix); invalid_syntax (buf); diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 1a82d13..609f82e 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -104,4 +104,12 @@ (ert-deftest lread-string-char-name () (should (equal (read "\"a\\N{SYLOTI NAGRI LETTER DHO}b\"") "a\uA817b"))) +(ert-deftest lread-empty-int-literal () + "Check that Bug#25120 is fixed." + (should-error (read "#b") :type 'invalid-read-syntax) + (should-error (read "#o") :type 'invalid-read-syntax) + (should-error (read "#x") :type 'invalid-read-syntax) + (should-error (read "#24r") :type 'invalid-read-syntax) + (should-error (read "#") :type 'invalid-read-syntax)) + ;;; lread-tests.el ends here -- 2.10.2