* coding.c (Ffind_operation_coding_system): Avoid subscript error.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 27 Sep 2011 16:31:12 +0000 (09:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 27 Sep 2011 16:31:12 +0000 (09:31 -0700)
src/ChangeLog
src/coding.c

index 7b09cb7..4f1edc9 100644 (file)
        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.
index 25ac0e9..e8765ae 100644 (file)
@@ -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];