Bug #794

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

Added by tadf (tadayoshi funaba) over 3 years ago. Updated about 1 year ago.

Status:Closed Start date:11/25/2008
Priority:Normal Due date:
Assignee:- % 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

Related issues

related to Backport86 - Backport #1589: Backport BigDecimal fixes Closed 06/09/2009

Associated revisions

Revision 20359
Added by matz (Yukihiro Matsumoto) over 3 years 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.

Revision 20359
Added by matz (Yukihiro Matsumoto) over 3 years 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

Updated by matz (Yukihiro Matsumoto) over 3 years ago

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

Also available in: Atom PDF