diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | variable.c | 11 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 14 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Thu Aug 16 04:30:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * variable.c (rb_path2class): get rid of dangling pointer caused by + optimized out value. + Thu Aug 16 04:24:28 2007 NAKAMURA Usaku <usa@ruby-lang.org> * ext/dl/lib/dl/win32.rb: seems that dl doesn't accept void argument. diff --git a/variable.c b/variable.c index a51dd9ea58..4231a75827 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; @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2007-08-16" #define RUBY_VERSION_CODE 185 #define RUBY_RELEASE_CODE 20070816 -#define RUBY_PATCHLEVEL 59 +#define RUBY_PATCHLEVEL 60 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |