Bug #8687

mathn and round causes an segmentationfault

Added by Hans Mackowiak 9 months ago. Updated 9 months ago.

[ruby-core:56177]
Status:Closed
Priority:Normal
Assignee:-
Category:-
Target version:-
ruby -v:ruby 2.1.0dev (2013-07-25) [x86_64-darwin12.4.0] Backport:1.9.3: DONE, 2.0.0: DONE

Description

require "mathn"; (5/2).round(2)

-- Control frame information -----------------------------------------------
c:0019 p:---- s:0076 e:000075 CFUNC :round
c:0018 p:0013 s:0072 e:000071 EVAL (irb):4 [FINISH]
c:0017 p:---- s:0070 e:000069 CFUNC :eval
c:0016 p:0024 s:0063 e:000062 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb:86
c:0015 p:0025 s:0056 e:000054 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/context.rb:380
c:0014 p:0022 s:0050 e:000049 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:492
c:0013 p:0040 s:0042 e:000041 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:624
c:0012 p:0009 s:0037 e:000036 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:489
c:0011 p:0118 s:0033 e:000032 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:247 [FINISH]
c:0010 p:---- s:0030 e:000029 CFUNC :loop
c:0009 p:0007 s:0027 e:000026 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:233 [FINISH]
c:0008 p:---- s:0025 e:000024 CFUNC :catch
c:0007 p:0015 s:0021 e:000020 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:232
c:0006 p:0030 s:0018 E:0009a8 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:488
c:0005 p:0008 s:0015 e:000014 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:397 [FINISH]
c:0004 p:---- s:0013 e:000012 CFUNC :catch
c:0003 p:0143 s:0009 E:001178 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:396
c:0002 p:0112 s:0004 E:000ca8 EVAL /Users/hanmac/.rvm/rubies/ruby-head/bin/irb:15 [FINISH]
c:0001 p:0000 s:0002 E:0011e8 TOP [FINISH]

/Users/hanmac/.rvm/rubies/ruby-head/bin/irb:15:in <main>'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:396:in
start'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:396:in catch'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:397:in
block in start'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:488:in eval_input'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in
eachtoplevelstatement'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in catch'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in
block in each
toplevelstatement'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in loop'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:247:in
block (2 levels) in eachtoplevelstatement'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:489:in block in eval_input'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:624:in
signal
status'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:492:in block (2 levels) in eval_input'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/context.rb:380:in
evaluate'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb:86:in evaluate'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb:86:in
eval'
(irb):4:in irb_binding'
(irb):4:in
round'

-- C level backtrace information -------------------------------------------
0 libruby.2.1.0.dylib 0x000000010cada749 rbvmbugreport + 137
1 libruby.2.1.0.dylib 0x000000010c99ee2b reportbug + 283
2 libruby.2.1.0.dylib 0x000000010c99ed04 rb
bug + 180
3 libruby.2.1.0.dylib 0x000000010ca5f190 sigsegv + 144
4 libsystemc.dylib 0x00007fff9081194a _sigtramp + 26
5 libruby.2.1.0.dylib 0x000000010ca2e1ea nurat
round + 10
6 ??? 0x0000000000000000 0x0 + 0

-- Other runtime information -----------------------------------------------

  • Loaded script: irb

  • Loaded features:

    0 enumerator.so
    1 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x8664-darwin12.4.0/enc/encdb.bundle
    2 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86
    64-darwin12.4.0/enc/trans/transdb.bundle
    3 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x8664-darwin12.4.0/rbconfig.rb
    4 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/compatibility.rb
    5 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/siteruby/2.1.0/rubygems/defaults.rb
    6 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/deprecate.rb
    7 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/siteruby/2.1.0/rubygems/errors.rb
    8 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/version.rb
    9 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/siteruby/2.1.0/rubygems/requirement.rb
    10 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/platform.rb
    11 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/siteruby/2.1.0/rubygems/specification.rb
    12 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/exceptions.rb
    13 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/siteruby/2.1.0/rubygems/coreext/kernelgem.rb
    14 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/thread.rb
    15 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/monitor.rb
    16 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/coreext/kernelrequire.rb
    17 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/siteruby/2.1.0/rubygems.rb
    18 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/e2mmap.rb
    19 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/init.rb
    20 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb
    21 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/inspector.rb
    22 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/context.rb
    23 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/extend-command.rb
    24 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/output-method.rb
    25 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/notifier.rb
    26 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/slex.rb
    27 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-token.rb
    28 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb
    29 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/src
    encoding.rb
    30 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/magic-file.rb
    31 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x8664-darwin12.4.0/readline.bundle
    32 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/input-method.rb
    33 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/locale.rb
    34 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb
    35 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/pathsupport.rb
    36 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site
    ruby/2.1.0/rubygems/dependency.rb
    37 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/completion.rb
    38 /Users/hanmac/.rvm/scripts/irbrc.rb
    39 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/cmath.rb
    40 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/matrix.rb
    41 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/singleton.rb
    42 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/forwardable.rb
    43 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/prime.rb
    44 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x8664-darwin12.4.0/mathn/rational.bundle
    45 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86
    64-darwin12.4.0/mathn/complex.bundle
    46 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/mathn.rb


Related issues

Duplicated by ruby-trunk - Bug #8924: mathn/rational causes segmentation fault when calling :ro... Closed 09/19/2013

Associated revisions

Revision 42178
Added by Nobuyoshi Nakada 9 months ago

rational.c: ensure to be Rational

  • rational.c (froundcommon): Rational is expected to be returned by Rational#*, but mathn.rb breaks that assumption. [Bug #8687]

History

#1 Updated by Nobuyoshi Nakada 9 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42178.
Hans, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


rational.c: ensure to be Rational

  • rational.c (froundcommon): Rational is expected to be returned by Rational#*, but mathn.rb breaks that assumption. [Bug #8687]

#2 Updated by Nobuyoshi Nakada 9 months ago

  • Description updated (diff)
  • Priority changed from Urgent to Normal
  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED

#3 Updated by Tomoyuki Chikanaga 9 months ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED to 1.9.3: REQUIRED, 2.0.0: DONE

Backported to ruby20_0 at r42217.

#4 Updated by Usaku NAKAMURA 9 months ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: DONE to 1.9.3: DONE, 2.0.0: DONE

Backported to ruby19_3 at r42326.

Also available in: Atom PDF