use NUM2SIZET instead of NUM2INT

* ext/dl/dl.c (rb_dl_realloc): use NUM2SIZET instead of NUM2INT.

* ext/fiddle/fiddle.c (rb_fiddle_realloc): ditto.

* ext/dl/dl.c (rb_dl_malloc): use NUM2SIZET instead of NUM2INT.
  Coverity Scan found this bug.

* ext/fiddle/fiddle.c (rb_fiddle_malloc): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2014-02-25 14:18:13 +00:00
Родитель df9199d468
Коммит 4f180097d3
3 изменённых файлов: 17 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,16 @@
Tue Feb 25 22:52:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* ext/dl/dl.c (rb_dl_realloc): use NUM2SIZET instead of NUM2INT.
* ext/fiddle/fiddle.c (rb_fiddle_realloc): ditto.
Tue Feb 25 22:49:30 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* ext/dl/dl.c (rb_dl_malloc): use NUM2SIZET instead of NUM2INT.
Coverity Scan found this bug.
* ext/fiddle/fiddle.c (rb_fiddle_malloc): ditto.
Tue Feb 25 12:06:13 2014 NARUSE, Yui <naruse@ruby-lang.org>
* win32/Makefile.sub: define PACKED_STRUCT.

Просмотреть файл

@ -81,7 +81,7 @@ rb_dl_malloc(VALUE self, VALUE size)
{
void *ptr;
ptr = (void*)ruby_xmalloc(NUM2INT(size));
ptr = (void*)ruby_xmalloc(NUM2SIZET(size));
return PTR2NUM(ptr);
}
@ -97,7 +97,7 @@ rb_dl_realloc(VALUE self, VALUE addr, VALUE size)
{
void *ptr = NUM2PTR(addr);
ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
return PTR2NUM(ptr);
}

Просмотреть файл

@ -48,7 +48,7 @@ rb_fiddle_malloc(VALUE self, VALUE size)
{
void *ptr;
ptr = (void*)ruby_xmalloc(NUM2INT(size));
ptr = (void*)ruby_xmalloc(NUM2SIZET(size));
return PTR2NUM(ptr);
}
@ -64,7 +64,7 @@ rb_fiddle_realloc(VALUE self, VALUE addr, VALUE size)
{
void *ptr = NUM2PTR(addr);
ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
return PTR2NUM(ptr);
}