diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 10 | ||||
-rw-r--r-- | string.c | 19 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 18 insertions, 18 deletions
@@ -1,3 +1,8 @@ +Thu Oct 15 16:57:38 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (rb_intern3): check symbol table overflow. + [ruby-core:26092] + Sun Oct 11 15:54:52 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * ext/gdbm/gdbm.c (fgdbm_select): fixed rdoc. a patch from Justin @@ -9577,6 +9577,16 @@ rb_intern3(const char *name, long len, rb_encoding *enc) mbstr:; } new_id: + if (!(global_symbols.last_id << (ID_SCOPE_SHIFT+RUBY_SPECIAL_SHIFT))) { + if (len > 20) { + rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.20s...)", + name); + } + else { + rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.*s)", + (int)len, name); + } + } id |= ++global_symbols.last_id << ID_SCOPE_SHIFT; id_register: return register_symid(id, name, len, enc); @@ -6379,25 +6379,10 @@ VALUE rb_str_intern(VALUE s) { VALUE str = RB_GC_GUARD(s); - VALUE sym; - ID id, id2; + ID id; id = rb_intern_str(str); - sym = ID2SYM(id); - id2 = SYM2ID(sym); - if (id != id2) { - const 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; + return ID2SYM(id); } @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 364 +#define RUBY_PATCHLEVEL 365 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |