Project

General

Profile

Actions

Bug #2227

closed

invalid memory access in 100**900

Added by mame (Yusuke Endoh) almost 16 years ago. Updated over 14 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-10-18 trunk 25392) [x86_64-freebsd7.2]
Backport:
[ruby-dev:39503]

Description

=begin
遠藤です。

2009年10月17日9:01 Tanaka Akira :

以下のように、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
=end

Actions #1

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

Actions #2

Updated by mame (Yusuke Endoh) almost 16 years ago

  • Status changed from Assigned to Closed

=begin

r25383で修正済みですよね?

その通りです。
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0