[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9f2d21c: Avoid undefined behavior in 'defvar' (Bug#
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 9f2d21c: Avoid undefined behavior in 'defvar' (Bug#31072) |
Date: |
Mon, 16 Apr 2018 02:50:16 -0400 (EDT) |
branch: master
commit 9f2d21ca536ea7ca1da98e7bd57ae535ab394997
Author: Philipp Stephani <address@hidden>
Commit: Paul Eggert <address@hidden>
Avoid undefined behavior in 'defvar' (Bug#31072)
* src/eval.c (Fdefvar): Check that first argument is a symbol.
* test/src/eval-tests.el (defvar/bug31072): New unit test.
---
src/eval.c | 2 ++
test/src/eval-tests.el | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/src/eval.c b/src/eval.c
index a6e1d86..90d8c33 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -737,6 +737,8 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
sym = XCAR (args);
tail = XCDR (args);
+ CHECK_SYMBOL (sym);
+
if (!NILP (tail))
{
if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail))))
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el
index 59da6b7..319dd91 100644
--- a/test/src/eval-tests.el
+++ b/test/src/eval-tests.el
@@ -113,4 +113,8 @@ crash/abort/malloc assert failure on the next test."
(signal-hook-function #'ignore))
(should-error (eval-tests--exceed-specbind-limit))))
+(ert-deftest defvar/bug31072 ()
+ "Check that Bug#31072 is fixed."
+ (should-error (eval '(defvar 1) t) :type 'wrong-type-argument))
+
;;; eval-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 9f2d21c: Avoid undefined behavior in 'defvar' (Bug#31072),
Paul Eggert <=