diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-20 00:43:39 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-20 00:43:39 +0000 |
commit | 9a82a62937ab8978766b5f88208e8c44d9f6941a (patch) | |
tree | c195f3699db6d8f2d2bfd93510528bd74cf1475d | |
parent | 1c32ff927f02f17a0e6cfe6edb375bbd3d309d09 (diff) | |
download | ruby-9a82a62937ab8978766b5f88208e8c44d9f6941a.tar.gz |
* 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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | bignum.c | 4 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Thu Dec 20 09:42:11 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * 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@ruby-lang.org> * string.c (rb_str_index): wrong starting position. @@ -837,12 +837,12 @@ big2str_orig(VALUE x, int base, char* ptr, long len, long hbase, int trim) 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; } |