Mercurial > hg > xemacs-beta
changeset 4796:c45fdd4e1858
Don't args-out-of-range in compare-strings.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Sat, 02 Jan 2010 01:02:43 +0900 |
parents | 084056f46755 |
children | a5eca70cf401 |
files | src/ChangeLog src/fns.c |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Fri Jan 01 00:21:07 2010 +0000 +++ b/src/ChangeLog Sat Jan 02 01:02:43 2010 +0900 @@ -38,6 +38,10 @@ Indicate that accepting attempted modification of keywords is a temporary thing. +2009-12-23 Stephen J. Turnbull <stephen@xemacs.org> + + * fns.c (Fcompare_strings): Coerce bounds to be within strings. + 2009-12-18 Jerry James <james@xemacs.org> * ppc.ldscript: Remove, obsolete.
--- a/src/fns.c Fri Jan 01 00:21:07 2010 +0000 +++ b/src/fns.c Sat Jan 02 01:02:43 2010 +0900 @@ -315,9 +315,12 @@ Compare the contents of two strings, maybe ignoring case. In string STR1, skip the first START1 characters and stop at END1. In string STR2, skip the first START2 characters and stop at END2. -END1 and END2 default to the full lengths of the respective strings. - -Case is significant in this comparison if IGNORE-CASE is nil. +END1 and END2 default to the full lengths of the respective strings, +and arguments that are outside the string (negative start or ENDi +greater than length) are coerced to 0 or string length as appropriate. + +Optional IGNORE-CASE non-nil means use case-insensitive comparison. +Case is significant by default. The value is t if the strings (or specified portions) match. If string STR1 is less, the value is a negative number N; @@ -335,9 +338,9 @@ CHECK_STRING (str1); CHECK_STRING (str2); get_string_range_char (str1, start1, end1, &ccstart1, &ccend1, - GB_HISTORICAL_STRING_BEHAVIOR); + GB_HISTORICAL_STRING_BEHAVIOR|GB_COERCE_RANGE); get_string_range_char (str2, start2, end2, &ccstart2, &ccend2, - GB_HISTORICAL_STRING_BEHAVIOR); + GB_HISTORICAL_STRING_BEHAVIOR|GB_COERCE_RANGE); bstart1 = string_index_char_to_byte (str1, ccstart1); blen1 = string_offset_char_to_byte_len (str1, bstart1, ccend1 - ccstart1);