summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string.c b/string.c
index 733a7dfc30..42177887a8 100644
--- a/string.c
+++ b/string.c
@@ -1836,6 +1836,9 @@ rb_str_to_i(argc, argv, str)
if (argc == 0) base = 10;
else base = NUM2INT(b);
+ if (base < 0) {
+ rb_raise(rb_eArgError, "illegal radix %d", base);
+ }
return rb_str_to_inum(str, base, Qfalse);
}