summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 07:22:12 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 07:22:12 +0000
commit658da719bf86713cd350adcba78f93190719baa0 (patch)
tree020127120ddbdcd430de825ad40c8f7cf2c08899 /parse.y
parent5ee39c26491e57a97f87896a7e1e76a5472157c1 (diff)
Sun, 3 Oct 2010 09:30:30 +0000 nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
merge revision(s) 29396: * parse.y (rb_intern): should check symbol table overflow. #3900 [ruby-dev:42330] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@29863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 9f14466816..df19699c0d 100644
--- a/parse.y
+++ b/parse.y
@@ -6222,6 +6222,16 @@ rb_intern(name)
}
if (*m) id = ID_JUNK;
new_id:
+ if (last_id >= SYM2ID(~(VALUE)0) >> ID_SCOPE_SHIFT) {
+ if (last > 20) {
+ rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.20s...)",
+ name);
+ }
+ else {
+ rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.*s)",
+ last, name);
+ }
+ }
id |= ++last_id << ID_SCOPE_SHIFT;
id_regist:
name = strdup(name);