* string.c (rb_str_intern): should check symbol table overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00b129c4e4
commit
71553b91f6
@ -1,3 +1,7 @@
|
||||
Tue Aug 12 15:37:40 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_intern): should check symbol table overflow.
|
||||
|
||||
Tue Aug 12 15:31:04 2008 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/net/http.rb (send_request_with_body): Content-Length should
|
||||
|
19
string.c
19
string.c
@ -5840,10 +5840,25 @@ VALUE
|
||||
rb_str_intern(VALUE s)
|
||||
{
|
||||
VALUE str = RB_GC_GUARD(s);
|
||||
ID id;
|
||||
VALUE sym;
|
||||
ID id, id2;
|
||||
|
||||
id = rb_intern_str(str);
|
||||
return ID2SYM(id);
|
||||
sym = ID2SYM(id);
|
||||
id2 = SYM2ID(sym);
|
||||
if (id != id2) {
|
||||
char *name = rb_id2name(id2);
|
||||
|
||||
if (name) {
|
||||
rb_raise(rb_eRuntimeError, "symbol table overflow (%s given for %s)",
|
||||
name, RSTRING_PTR(str));
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %s)",
|
||||
RSTRING_PTR(str));
|
||||
}
|
||||
}
|
||||
return sym;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user