mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 04:24:04 +02:00
rational.c: segfault on Rational exponent
* rational.c (read_num): fix segfault on Rational() with positive but less than the length of fractional part exponent. should be negated to convert to divisor which is a reciprocal. [ruby-core:85783] [Bug #14547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
623160916d
commit
f954caea43
2 changed files with 18 additions and 8 deletions
|
@ -110,6 +110,10 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_equal(Rational(3),Rational('3'))
|
||||
assert_equal(Rational(1),Rational('3.0','3.0'))
|
||||
assert_equal(Rational(1),Rational('3/3','3/3'))
|
||||
assert_equal(Rational(111, 10), Rational('1.11e+1'))
|
||||
assert_equal(Rational(111, 10), Rational('1.11e1'))
|
||||
assert_equal(Rational(111, 100), Rational('1.11e0'))
|
||||
assert_equal(Rational(111, 1000), Rational('1.11e-1'))
|
||||
assert_raise(TypeError){Rational(nil)}
|
||||
assert_raise(ArgumentError){Rational('')}
|
||||
assert_raise_with_message(ArgumentError, /\u{221a 2668}/) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue