]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid crashes in Fdocumentation caused by incorrect data types
authorPip Cet <pipcet@protonmail.com>
Sun, 26 Jan 2025 14:34:45 +0000 (14:34 +0000)
committerEshel Yaron <me@eshelyaron.com>
Sun, 26 Jan 2025 19:02:35 +0000 (20:02 +0100)
Note that this can only change things when function-documentation is
defined or overloaded incorrectly.

* src/doc.c (Fdocumentation): Check that the cdr of a docstring cons
is a fixnum.

(cherry picked from commit b07c12ce59c96db753a1f8f3a829f9ab5514e35f)

src/doc.c

index 6f4ce79f1f139d436609629edd9070789eb6643c..09e099efcdb8cf8df01060915d39cfd07b0ade70 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -362,7 +362,7 @@ string is passed through `substitute-command-keys'.  */)
      from the DOC file (bug in src/Makefile.in).  */
   if (BASE_EQ (doc, make_fixnum (0)))
     doc = Qnil;
-  if (FIXNUMP (doc) || CONSP (doc))
+  if (FIXNUMP (doc) || (CONSP (doc) && FIXNUMP (XCDR (doc))))
     {
       Lisp_Object tem = get_doc_string (doc, 0);
       if (NILP (tem) && try_reload)