From 967cca2f8d13c113461f26879d501b03cfeec6c0 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 21 Jun 2007 14:16:00 +0000 Subject: [PATCH] * parse.y (rb_intern2): ID_JUNK test based on len, not by NUL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ parse.y | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 891e708a88..ddbd7e8697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jun 21 23:08:19 2007 Yukihiro Matsumoto + + * parse.y (rb_intern2): ID_JUNK test based on len, not by NUL. + Thu Jun 21 19:42:07 2007 Nobuyoshi Nakada * yarvcore.c (rb_thread_mark): mark also thrown_errinfo. diff --git a/parse.y b/parse.y index 70c57ac796..c2ca84ce3f 100644 --- a/parse.y +++ b/parse.y @@ -8420,8 +8420,8 @@ rb_symname_p(const char *name) ID rb_intern2(const char *name, long len) { + const char *m = name; VALUE str = rb_str_new(name, len); - const char *m = RSTRING_PTR(str); ID id; int last; @@ -8481,7 +8481,7 @@ rb_intern2(const char *name, long len) m += mbclen(*m); } } - if (*m) id = ID_JUNK; + if (m - name < len) id = ID_JUNK; new_id: id |= ++global_symbols.last_id << ID_SCOPE_SHIFT; id_register: