diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-17 15:56:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-17 15:56:36 +0000 |
commit | dd307cae31f98d578915637bdc91e98d5d1a608d (patch) | |
tree | 115ff9f27a3c58f2ad555314823713f5c46363b5 | |
parent | 5cf53bcb016926bb220e01e86ae37f97b07806d6 (diff) |
* variable.c (rb_path2class): get rid of dangling pointer caused by
optimized out value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | variable.c | 11 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 16 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Mon Jun 18 00:58:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * variable.c (rb_path2class): get rid of dangling pointer caused by + optimized out value. + Fri Jun 15 22:33:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> * common.mk (realclean): separate local and ext. diff --git a/variable.c b/variable.c index 44e2403639..e00f1ef6eb 100644 --- a/variable.c +++ b/variable.c @@ -241,16 +241,21 @@ rb_path2class(path) const char *pbeg, *p; ID id; VALUE c = rb_cObject; + VALUE str = 0; if (path[0] == '#') { rb_raise(rb_eArgError, "can't retrieve anonymous class %s", path); } pbeg = p = path; while (*p) { - VALUE str; - while (*p && *p != ':') p++; - str = rb_str_new(pbeg, p-pbeg); + if (str) { + RSTRING(str)->len = 0; + rb_str_cat(str, pbeg, p-pbeg); + } + else { + str = rb_str_new(pbeg, p-pbeg); + } id = rb_intern(RSTRING(str)->ptr); if (p[0] == ':') { if (p[1] != ':') goto undefined_class; @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2007-06-15" +#define RUBY_RELEASE_DATE "2007-06-18" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20070615 +#define RUBY_RELEASE_CODE 20070618 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 15 +#define RUBY_RELEASE_DAY 18 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |