mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-30 08:09:04 +00:00
Fix valgrind report in call-interactively
* src/callint.c (Fcall_interactively): Don't try to access more bytes than are available in the interactive spec. (Bug#30004)
This commit is contained in:
parent
d5f1c87bfe
commit
3a22097cf6
@ -774,10 +774,23 @@ invoke it. If KEYS is omitted or nil, the return value of
|
||||
if anyone tries to define one here. */
|
||||
case '+':
|
||||
default:
|
||||
error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
|
||||
STRING_CHAR ((unsigned char *) tem),
|
||||
(unsigned) STRING_CHAR ((unsigned char *) tem),
|
||||
(unsigned) STRING_CHAR ((unsigned char *) tem));
|
||||
{
|
||||
/* How many bytes are left unprocessed in the specs string?
|
||||
(Note that this excludes the trailing null byte.) */
|
||||
ptrdiff_t bytes_left = SBYTES (specs) - (tem - string);
|
||||
unsigned letter;
|
||||
|
||||
/* If we have enough bytes left to treat the sequence as a
|
||||
character, show that character's codepoint; otherwise
|
||||
show only its first byte. */
|
||||
if (bytes_left >= BYTES_BY_CHAR_HEAD (*((unsigned char *) tem)))
|
||||
letter = STRING_CHAR ((unsigned char *) tem);
|
||||
else
|
||||
letter = *((unsigned char *) tem);
|
||||
|
||||
error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
|
||||
(int) letter, letter, letter);
|
||||
}
|
||||
}
|
||||
|
||||
if (varies[i] == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user