aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorPhilipp Stephani2018-04-15 23:45:27 -0700
committerPaul Eggert2018-04-15 23:50:06 -0700
commit9f2d21ca536ea7ca1da98e7bd57ae535ab394997 (patch)
treecc40bd68be4070f926852a8129f3d84ccb6bd86c /src/eval.c
parent836dce63c3274eaa84a26c09a5b6dcb1522dba98 (diff)
downloademacs-9f2d21ca536ea7ca1da98e7bd57ae535ab394997.tar.gz
emacs-9f2d21ca536ea7ca1da98e7bd57ae535ab394997.zip
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.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index a6e1d86c4ab..90d8c335185 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -737,6 +737,8 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
737 sym = XCAR (args); 737 sym = XCAR (args);
738 tail = XCDR (args); 738 tail = XCDR (args);
739 739
740 CHECK_SYMBOL (sym);
741
740 if (!NILP (tail)) 742 if (!NILP (tail))
741 { 743 {
742 if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) 744 if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail))))