1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

Avoid crashes in 'describe-keymap' due to shadowing

* src/keymap.c (describe_vector): Handle shadowing by something
other than a symbol.  (Bug#62867)
This commit is contained in:
Eli Zaretskii 2023-04-16 08:51:22 +03:00
parent b7023da662
commit 39035fbfc5

View File

@ -3308,13 +3308,18 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
if (this_shadowed)
{
SET_PT (PT - 1);
static char const fmt[] = " (currently shadowed by `%s')";
USE_SAFE_ALLOCA;
char *buffer = SAFE_ALLOCA (sizeof fmt +
SBYTES (SYMBOL_NAME (shadowed_by)));
esprintf (buffer, fmt, SDATA (SYMBOL_NAME (shadowed_by)));
insert_string (buffer);
SAFE_FREE();
if (SYMBOLP (shadowed_by))
{
static char const fmt[] = " (currently shadowed by `%s')";
USE_SAFE_ALLOCA;
char *buffer =
SAFE_ALLOCA (sizeof fmt + SBYTES (SYMBOL_NAME (shadowed_by)));
esprintf (buffer, fmt, SDATA (SYMBOL_NAME (shadowed_by)));
insert_string (buffer);
SAFE_FREE();
}
else /* Could be a keymap, a lambda, or a keyboard macro. */
insert_string (" (currently shadowed)");
SET_PT (PT + 1);
}
}