From a5f323835e764b4f6d01ff34b0b245561f278f26 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 8 Jun 2021 16:59:57 +0900 Subject: string.c: add `base>36` check to `String#to_i`. --- src/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/string.c b/src/string.c index 2258dce2c..679e6585a 100644 --- a/src/string.c +++ b/src/string.c @@ -2439,7 +2439,7 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self) mrb_int base = 10; mrb_get_args(mrb, "|i", &base); - if (base < 0) { + if (base < 0 || 36 < base) { mrb_raisef(mrb, E_ARGUMENT_ERROR, "illegal radix %i", base); } return mrb_str_to_inum(mrb, self, base, FALSE); -- cgit v1.2.3