Bug #794

BigDecimal が Segmentation fault で落ることがある

Added by tadayoshi funaba 477 days ago. Updated 477 days ago.

Status :Closed Start :11/25/2008
Priority :Normal Due date :
Assigned to :- % Done :

100%

Category :-
Target version :-
ruby -v :


Description

$ ./ruby -r bigdecimal -e 'BigDecimal("1"*10000000)'
-e:1: [BUG] Segmentation fault
ruby 1.9.0 (2008-11-25 revision 20353) [i686-linux]

-- control frame ----------
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :BigDecimal
c:0003 p:0014 s:0006 b:0006 l:000005 d:000005 TOP    -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP    <dummy toplevel>:17
---------------------------
Segmentation fault


$ ruby18 -r bigdecimal -e 'BigDecimal("1"*10000000)'
Segmentation fault

Associated revisions

Revision 20359
Added by matz 477 days ago

  • ext/bigdecimal/bigdecimal.c (VpAlloc): avoid ALLOCA_N() to avoid segmentation fault caused by (insanely) long decimal values. [ruby-dev:37189] fix #794
  • ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_to_i, BigDecimal_to_f, BigDecimal_to_s, BigDecimal_split, BigDecimal_inspect): ditto.
  • ext/bigdecimal/bigdecimal.c (VpToString): small performance improvement.

History

11/26/2008 03:08 AM - Yukihiro Matsumoto

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r20359.

Also available in: Atom PDF