1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-26 19:18:50 +00:00

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.
This commit is contained in:
Philipp Stephani 2016-12-10 15:36:11 +01:00
parent 831bef1a46
commit 6eaadcc7c8
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -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