diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-06 05:14:53 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-06 05:14:53 +0000 |
commit | 326ce405209d3910d014d7ed4e950f3149ee839e (patch) | |
tree | f983c396ec69c57ec1687eb4f59977e2a6ad0f7e | |
parent | 4be94836bd5eb2e2815c5b04c5427e05e9dc98d8 (diff) |
merge revision(s) 37174: [Backport #7754]
* file.c (realpath_rec): prevent link from GC while link_names refers
the content.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@39092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | file.c | 3 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Feb 6 14:14:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * file.c (realpath_rec): prevent link from GC while link_names refers + the content. + Wed Feb 6 14:13:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * missing/setproctitle.c (environ): use (*_NSGetEnviron()) instead of @@ -3378,6 +3378,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l #ifdef HAVE_READLINK if (S_ISLNK(sbuf.st_mode)) { VALUE link; + volatile VALUE link_orig = Qnil; const char *link_prefix, *link_names; long link_prefixlen; rb_hash_aset(loopcheck, testpath, ID2SYM(resolving)); @@ -3387,6 +3388,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l link_prefixlen = link_names - link_prefix; if (link_prefixlen > 0) { rb_encoding *enc, *linkenc = rb_enc_get(link); + link_orig = link; link = rb_str_subseq(link, 0, link_prefixlen); enc = rb_enc_check(*resolvedp, link); if (enc != linkenc) link = rb_str_conv_enc(link, linkenc, enc); @@ -3394,6 +3396,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l *prefixlenp = link_prefixlen; } realpath_rec(prefixlenp, resolvedp, link_names, loopcheck, strict, *unresolved_firstsep == '\0'); + RB_GC_GUARD(link_orig); rb_hash_aset(loopcheck, testpath, rb_str_dup_frozen(*resolvedp)); } else @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 377 +#define RUBY_PATCHLEVEL 378 #define RUBY_RELEASE_DATE "2013-02-06" #define RUBY_RELEASE_YEAR 2013 |