Avoid crashes in Fdocumentation caused by incorrect data types

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.
This commit is contained in:
Pip Cet 2025-01-26 14:34:45 +00:00
parent 8cfb4e35da
commit b07c12ce59

View file

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