From 27b3354397c9e8b6ddffcd15c97b260dde60517a Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 6 Sep 2008 09:39:12 +0000 Subject: * transcode.c (allocate_converted_string): fix overflow condition. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index cc3fc53c7..ccb54dfff 100644 --- a/transcode.c +++ b/transcode.c @@ -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; -- cgit