Project

General

Profile

Actions

Bug #8924

closed

mathn/rational causes segmentation fault when calling :round on a Rational

Added by bf4 (Benjamin Fleischer) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin10.8.0]
[ruby-core:57274]

Description

Summary: Confirmed for MRI 1.9/2.0 various patchlevels, on OS X Snow Leopard.

To reproduce:

covered_percent = Marshal.load("\x04\bU:\rRational[\ai\x01\xC8i\x0F")

or require 'yaml'; covered_percent = YAML.load("--- !ruby/object:Rational\ndenominator: 10\nnumerator: 200\n")

covered_percent.round(2) # => (20/1)
require 'mathn/rational'
covered_percent.round(2) # => segfault

Partial output:

/var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.0.7/lib/code_climate/test_reporter/formatter.rb:50: [BUG] Segmentation fault
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0013 p:---- s:0055 b:0055 l:000054 d:000054 CFUNC :round
c:0012 p:0198 s:0051 b:0042 l:000033 d:000041 BLOCK /var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.0.7/lib/code_climate/test
c:0011 p:---- s:0039 b:0039 l:000038 d:000038 FINISH
c:0010 p:---- s:0037 b:0037 l:000036 d:000036 CFUNC :map
c:0009 p:0037 s:0034 b:0034 l:000033 d:000033 METHOD /var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.0.7/lib/code_climate/test
c:0008 p:0046 s:0028 b:0028 l:000027 d:000027 METHOD /var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.0.7/lib/code_climate/test
c:0007 p:0030 s:0020 b:0020 l:000019 d:000019 METHOD /var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/simplecov-0.7.1/lib/simplecov/result.rb:91
c:0006 p:0021 s:0017 b:0017 l:001d00 d:000016 BLOCK /var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/simplecov-0.7.1/lib/simplecov/configuration.rb:133
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 FINISH
c:0004 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :call
c:0003 p:0070 s:0010 b:0010 l:0025e0 d:000009 BLOCK /var/lib/jenkins/workspace/Project_master/vendor/bundle/ruby/1.9.1/gems/simplecov-0.7.1/lib/simplecov/defaults.rb:52
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001618 d:001618 TOP


Files

crashlog.txt (402 KB) crashlog.txt bf4 (Benjamin Fleischer), 09/19/2013 01:45 PM

Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #8687: mathn and round causes an segmentationfaultClosed07/26/2013Actions

Updated by david_macmahon (David MacMahon) about 11 years ago

There was another issue recently where requiring "mathn/rational" by itself caused problems that did not occur when requiring "mathn" in its entirety.

Does the problem still occur if you "require 'mathn'" instead of "require 'mathn/rational'"?

Dave

Updated by nobu (Nobuyoshi Nakada) about 11 years ago

  • Status changed from Open to Closed
  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED

Updated by bf4 (Benjamin Fleischer) about 11 years ago

david_macmahon (David MacMahon) wrote:

There was another issue recently where requiring "mathn/rational" by itself caused problems that did not occur when requiring "mathn" in its entirety.

Does the problem still occur if you "require 'mathn'" instead of "require 'mathn/rational'"?

Yes.

Thanks @nobu (Nobuyoshi Nakada) for pointing me to the related issue with the fix. https://bugs.ruby-lang.org/issues/8687 I searched but didn't find it.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0