diff options
| -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 |
