From 5a2b28909ece2e1310250180f097bfcb7b0203dc Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Tue, 31 Jan 2023 13:39:13 +0900 Subject: merge revision(s) 3f54d09a5b8b6e4fd734abc8911e170d5967b5b0: [Backport #19390] bignum.c: rb_int_parse_cstr handle `0` strings [Bug #19390] We shouldn't check the string length when skipping zeros, as the string might only contains zero characters, resulting in an empty string. --- bignum.c | 1 - test/ruby/test_time.rb | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) --- test/ruby/test_time.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 38c1af6901..2bf6056a49 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -1426,4 +1426,8 @@ class TestTime < Test::Unit::TestCase t.deconstruct_keys(%i[year month sec nonexistent]) ) end + + def test_parse_zero_bigint + assert_equal 0, Time.new("2020-10-28T16:48:07.000Z").nsec, '[Bug #19390]' + end end -- cgit v1.2.3