[前][次][番号順一覧][スレッド一覧]

ruby-changes:33095

From: kazu <ko1@a...>
Date: Tue, 25 Feb 2014 23:18:21 +0900 (JST)
Subject: [ruby-changes:33095] kazu:r45174 (trunk): use NUM2SIZET instead of NUM2INT

kazu	2014-02-25 23:18:13 +0900 (Tue, 25 Feb 2014)

  New Revision: 45174

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45174

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/dl/dl.c
    trunk/ext/fiddle/fiddle.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45173)
+++ ChangeLog	(revision 45174)
@@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb 25 22:52:02 2014  Kazuhiro NISHIYAMA  <zn@m...>
+
+	* 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@m...>
+
+	* 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@r...>
 
 	* win32/Makefile.sub: define PACKED_STRUCT.
Index: ext/dl/dl.c
===================================================================
--- ext/dl/dl.c	(revision 45173)
+++ ext/dl/dl.c	(revision 45174)
@@ -81,7 +81,7 @@ rb_dl_malloc(VALUE self, VALUE size) https://github.com/ruby/ruby/blob/trunk/ext/dl/dl.c#L81
 {
     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, VA https://github.com/ruby/ruby/blob/trunk/ext/dl/dl.c#L97
 {
     void *ptr = NUM2PTR(addr);
 
-    ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
+    ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
     return PTR2NUM(ptr);
 }
 
Index: ext/fiddle/fiddle.c
===================================================================
--- ext/fiddle/fiddle.c	(revision 45173)
+++ ext/fiddle/fiddle.c	(revision 45174)
@@ -48,7 +48,7 @@ rb_fiddle_malloc(VALUE self, VALUE size) https://github.com/ruby/ruby/blob/trunk/ext/fiddle/fiddle.c#L48
 {
     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 https://github.com/ruby/ruby/blob/trunk/ext/fiddle/fiddle.c#L64
 {
     void *ptr = NUM2PTR(addr);
 
-    ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
+    ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
     return PTR2NUM(ptr);
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]