Actions
Bug #2227
closedinvalid memory access in 100**900
Description
=begin
遠藤です。
2009年10月17日9:01 Tanaka Akira akr@fsij.org:
以下のように、100**900 を計算すると変なところをアクセスするようです。
すみません、off-by-one エラーしてました。
Index: bignum.c¶
--- bignum.c (revision 25382)
+++ bignum.c (working copy)
@@ -1848,13 +1848,13 @@
while (--hn && !vds[hn + ln]);
h = bignew(hn += 2, 1);
- MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn);
- BDIGITS(h)[hn - 1] = 0;
-
MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn - 1);
-
BDIGITS(h)[hn - 1] = 0; /* margin for carry */
while (--ln && !vds[ln]);
l = bignew(ln += 2, 1);
- MEMCPY(BDIGITS(l), vds, BDIGIT, ln);
- BDIGITS(l)[ln - 1] = 0;
-
MEMCPY(BDIGITS(l), vds, BDIGIT, ln - 1);
-
BDIGITS(l)[ln - 1] = 0; /* margin for carry */
*pl = l;
*ph = h;
--
Yusuke ENDOH mame@tsg.ne.jp
=end
Updated by naruse (Yui NARUSE) almost 16 years ago
- Status changed from Open to Assigned
- Assignee set to mame (Yusuke Endoh)
- ruby -v set to ruby 1.9.2dev (2009-10-18 trunk 25392) [x86_64-freebsd7.2]
=begin
r25383で修正済みですよね?
=end
Updated by mame (Yusuke Endoh) almost 16 years ago
- Status changed from Assigned to Closed
=begin
r25383で修正済みですよね?
その通りです。
=end
Actions
Like0
Like0Like0