From 1eb8eb55c27b19e36d5bd23ce27f7ec2b9a7f521 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 12 Jan 2021 17:24:43 +0900 Subject: Convert time component strings to integers more strictly https://bugs.ruby-lang.org/issues/17485#change-89871 --- time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'time.c') diff --git a/time.c b/time.c index a3952743da..e7a211baa5 100644 --- a/time.c +++ b/time.c @@ -2793,7 +2793,7 @@ static int obj2int(VALUE obj) { if (RB_TYPE_P(obj, T_STRING)) { - obj = rb_str_to_inum(obj, 10, FALSE); + obj = rb_str_to_inum(obj, 10, TRUE); } return NUM2INT(obj); @@ -2815,7 +2815,7 @@ static VALUE obj2vint(VALUE obj) { if (RB_TYPE_P(obj, T_STRING)) { - obj = rb_str_to_inum(obj, 10, FALSE); + obj = rb_str_to_inum(obj, 10, TRUE); } else { obj = rb_to_int(obj); @@ -2830,7 +2830,7 @@ obj2subsecx(VALUE obj, VALUE *subsecx) VALUE subsec; if (RB_TYPE_P(obj, T_STRING)) { - obj = rb_str_to_inum(obj, 10, FALSE); + obj = rb_str_to_inum(obj, 10, TRUE); *subsecx = INT2FIX(0); } else { @@ -2844,7 +2844,7 @@ static VALUE usec2subsecx(VALUE obj) { if (RB_TYPE_P(obj, T_STRING)) { - obj = rb_str_to_inum(obj, 10, FALSE); + obj = rb_str_to_inum(obj, 10, TRUE); } return mulquov(num_exact(obj), INT2FIX(TIME_SCALE), INT2FIX(1000000)); -- cgit v1.2.3