summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-27 14:13:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-27 14:13:25 +0000
commit93695ed08a6e8f35aa7d26b3f4aa7d546a921e70 (patch)
tree51d2ac8f06b08a6431c01fe8f11acd74e627c75d
parent38bde8a9e0487db2eeb59227ae90d4391fbf0663 (diff)
* string.c (rb_str_to_i): disallow negative radix.
[ruby-dev:20087] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--string.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 97db6d8bce..0b7ba03833 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Apr 27 23:13:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_to_i): disallow negative radix.
+ [ruby-dev:20087]
+
Sat Apr 26 23:34:42 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (open_args): warning message changed to "don't put space
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);
}