summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 06:23:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 06:23:14 +0000
commit4a30a04247269cc3f7c43969677e6a513dcc789f (patch)
treeee71b604496d252e33daef2015e2ab10476c63db
parent36fda4a5ccee819e35e6c0b65cedcafa97e71690 (diff)
downloadruby-4a30a04247269cc3f7c43969677e6a513dcc789f.tar.gz
ruby-4a30a04247269cc3f7c43969677e6a513dcc789f.tar.xz
ruby-4a30a04247269cc3f7c43969677e6a513dcc789f.zip
* ext/iconv/iconv.c (iconv_convert): check upper bound. a patch from
Daniel Luz at [ruby-Bugs-17910]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/iconv/iconv.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 02e1c31d6..c78e65df2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 ed4623407..9f4c23b43 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;