diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/iconv/iconv.c | 5 |
2 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Fri Feb 15 15:23:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/iconv/iconv.c (iconv_convert): check upper bound. a patch from + Daniel Luz at [ruby-Bugs-17910]. + Fri Feb 15 10:35:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * re.c (rb_reg_quote): set US-ACII for ASCII-only string. diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index ed46234077..9f4c23b435 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -380,8 +380,11 @@ iconv_convert(iconv_t cd, VALUE str, int start, int length, int toidx, struct ic length = 0; else if ((length -= start) < 0) length = 0; - else + else { inptr += start; + if (length > slen) + length = slen; + } } instart = inptr; inlen = length; |