Commit 6eaadcc7 authored by Philipp Stephani's avatar Philipp Stephani

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.
parent 831bef1a
......@@ -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);
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment