* transcode.c (allocate_converted_string): fix overflow condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-06 09:39:12 +00:00
parent 4865967070
commit 987ec6b787
2 changed files with 5 additions and 1 deletions

View file

@ -1445,7 +1445,7 @@ allocate_converted_string(const char *sname, const char *dname,
res = rb_econv_convert(ec, &sp, str+len, &dp, dst_str+dst_bufsize, 0);
dst_len = dp - dst_str;
while (res == econv_destination_buffer_full) {
if (dst_bufsize * 2 < dst_bufsize) {
if (SIZE_MAX/2 < dst_bufsize) {
goto fail;
}
dst_bufsize *= 2;