From: Paul Eggert Date: Tue, 27 Sep 2011 16:31:12 +0000 (-0700) Subject: * coding.c (Ffind_operation_coding_system): Avoid subscript error. X-Git-Tag: emacs-24.2.90~471^2~6^2~174 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7b09a37a895ab2d428d1ab0786aa262ef82efba2;p=emacs.git * coding.c (Ffind_operation_coding_system): Avoid subscript error. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7b09cb744a3..4f1edc95668 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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. diff --git a/src/coding.c b/src/coding.c index 25ac0e9764c..e8765aea96d 100644 --- a/src/coding.c +++ b/src/coding.c @@ -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];