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

ruby-changes:2859

From: ko1@a...
Date: 20 Dec 2007 09:43:56 +0900
Subject: [ruby-changes:2859] matz - Ruby:r14350 (trunk): * bignum.c (big2str_orig): access beyond memory region cause crash

matz	2007-12-20 09:43:39 +0900 (Thu, 20 Dec 2007)

  New Revision: 14350

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

  Log:
    * bignum.c (big2str_orig): access beyond memory region cause crash
      on interrupt.  a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in 
      [ruby-dev:32651].  [ruby-dev:32641]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14350&r2=14349
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bignum.c?r1=14350&r2=14349

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14349)
+++ ChangeLog	(revision 14350)
@@ -1,3 +1,9 @@
+Thu Dec 20 09:42:11 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* bignum.c (big2str_orig): access beyond memory region cause crash
+	  on interrupt.  a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in 
+	  [ruby-dev:32651].  [ruby-dev:32641]
+
 Thu Dec 20 09:06:54 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* string.c (rb_str_index): wrong starting position.
Index: bignum.c
===================================================================
--- bignum.c	(revision 14349)
+++ bignum.c	(revision 14350)
@@ -837,12 +837,12 @@
         while (k--) {
             ptr[--j] = ruby_digitmap[num % base];
             num /= base;
-            if (!trim && j <= 0) break;
+            if (j <= 0) break;
             if (trim && i == 0 && num == 0) break;
         }
     }
     if (trim) {
-        while (ptr[j] == '0') j++;
+        while (j < len && ptr[j] == '0') j++;
         MEMMOVE(ptr, ptr + j, char, len - j);
         len -= j;
     }

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

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