Commit 7b09a37a authored by Paul Eggert's avatar Paul Eggert

* coding.c (Ffind_operation_coding_system): Avoid subscript error.

parent eee13465
......@@ -172,6 +172,7 @@
Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
(consume_chars): Rewrite to avoid calculating an address outside buffer.
(Ffind_operation_coding_system): NATNUMP can eval its arg twice.
Don't access memory outside of the args array.
(Fdefine_coding_system_internal): Check for charset-id overflow.
(ENCODE_ISO_CHARACTER): Use unsigned, not int, to store the unsigned
result of ENCODE_CHAR.
......
......@@ -9291,7 +9291,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
if (!SYMBOLP (operation)
|| (target_idx = Fget (operation, Qtarget_idx), !NATNUMP (target_idx)))
error ("Invalid first argument");
if (nargs < 1 + XFASTINT (target_idx))
if (nargs <= 1 + XFASTINT (target_idx))
error ("Too few arguments for operation `%s'",
SDATA (SYMBOL_NAME (operation)));
target = args[XFASTINT (target_idx) + 1];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment