[DRE-maint] Bug#1107208: libruby3.1: crash with math on certain BigDecimal numbers (bug in std library version 3.1), solution is upstream BigDecimal v3.1.2
Henry House
hajhouse at houseag.com
Tue Jun 3 05:00:19 BST 2025
Package: libruby3.1
Version: 3.1.2-7+deb12u1
Severity: important
Tags: upstream
Dear Maintainer,
There is a crash bug in Ruby 3.1's BigDecimal class of the standard library
that is triggered by math on certain numerical values, which to my
understanding is corrected in Ruby 3.2 and in this patch:
https://github.com/ruby/bigdecimal/commit/127a1b5a31c4290945035ec7e07bb7b185a81ee2 .
How to reproduce:
ruby -r bigdecimal -e "BigDecimal('1') / (BigDecimal('1') + 0.08)**19"
The result is program termination:
$ ruby -r bigdecimal -e "BigDecimal('1') / (BigDecimal('1') + 0.08)**19"
-e:1: [BUG] ERROR(VpDivd): space for remainder too small.
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
-- Control frame information -----------------------------------------------
c:0003 p:---- s:0011 e:000010 CFUNC :/
c:0002 p:0020 s:0006 e:000005 EVAL -e:1 [FINISH]
c:0001 p:0000 s:0003 E:000c90 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
-e:1:in `/'
-- C level backtrace information -------------------------------------------
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f5c0dc640d2) [0x7f5c0dc640d2]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f5c0dab21b3) [0x7f5c0dab21b3]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(rb_bug+0x99) [0x7f5c0da39982]
/usr/lib/x86_64-linux-gnu/ruby/3.1.0/bigdecimal.so(0x7f5c09d166ce) [0x7f5c09d166ce]
/usr/lib/x86_64-linux-gnu/ruby/3.1.0/bigdecimal.so(0x7f5c09d21df8) [0x7f5c09d21df8]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f5c0dc48ac0) [0x7f5c0dc48ac0]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f5c0dc4b3bb) [0x7f5c0dc4b3bb]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f5c0dc4e1ce) [0x7f5c0dc4e1ce]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(rb_vm_exec+0xb3) [0x7f5c0dc526a3]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f5c0dab8010) [0x7f5c0dab8010]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(ruby_run_node+0x55) [0x7f5c0dabba15]
ruby(0x55fbcfd7010b) [0x55fbcfd7010b]
/lib/x86_64-linux-gnu/libc.so.6(0x7f5c0d6a924a) [0x7f5c0d6a924a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f5c0d6a9305]
ruby(_start+0x21) [0x55fbcfd70151]
-- Other runtime information -----------------------------------------------
[...]
(Copious additional output truncated.)
As noted, to reproduce, try executing "BigDecimal('1') / (BigDecimal('1') + 0.08)**19".
This is a bug in Ruby's BigDecimal's github tracker,
https://github.com/ruby/bigdecimal/issues/220
which is closed by patch,
https://github.com/ruby/bigdecimal/commit/127a1b5a31c4290945035ec7e07bb7b185a81ee2 .
which is in BigDecimal release 3.1.2.
https://github.com/ruby/bigdecimal/releases/tag/v3.1.2
-- System Information:
Debian Release: 12.11
APT prefers stable
APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-28-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libruby3.1 depends on:
ii libc6 2.36-9+deb12u10
ii libcrypt1 1:4.4.33-2
ii libedit2 3.1-20221030-2
ii libffi8 3.4.4-1
ii libgmp10 2:6.2.1+dfsg1-1.1
ii libncurses6 6.4-4
ii libssl3 3.0.16-1~deb12u1
ii libtinfo6 6.4-4
ii libyaml-0-2 0.2.5-1
ii rake 13.0.6-3
ii ruby-net-telnet 0.2.0-1
ii ruby-sdbm 1.0.0-5+b1
ii ruby-webrick 1.8.1-1
ii ruby-xmlrpc 0.3.2-2
ii zlib1g 1:1.2.13.dfsg-1
libruby3.1 recommends no packages.
libruby3.1 suggests no packages.
-- no debconf information
More information about the Pkg-ruby-extras-maintainers
mailing list