1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c (VpMemAlloc): CVE-2011-0188.

Fixes a bug reported by Drew Yao <ayao at apple.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mrkn 2011-03-01 04:40:49 +00:00
parent d301b4d80b
commit f83651ac30
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Tue Mar 1 13:25:00 2011 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (VpMemAlloc): CVE-2011-0188.
Fixes a bug reported by Drew Yao <ayao at apple.com>
Tue Mar 1 10:34:39 2011 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_str_byteslice): Add String#byteslice. [ruby-core:35376]

View file

@ -2237,11 +2237,11 @@ static int gnAlloc=0; /* Memory allocation counter */
VP_EXPORT void *
VpMemAlloc(size_t mb)
{
void *p = xmalloc((unsigned int)mb);
if(!p) {
VpException(VP_EXCEPTION_MEMORY,"failed to allocate memory",1);
void *p = xmalloc(mb);
if (!p) {
VpException(VP_EXCEPTION_MEMORY, "failed to allocate memory", 1);
}
memset(p,0,mb);
memset(p, 0, mb);
#ifdef BIGDECIMAL_DEBUG
gnAlloc++; /* Count allocation call */
#endif /* BIGDECIMAL_DEBUG */