diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-29 04:43:10 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-29 04:43:10 +0000 |
commit | 847b7bcfb3db371acb552200913e5302c3759796 (patch) | |
tree | 45bb640145b58048241889940beb54d2cb6b3d1a /marshal.c | |
parent | ed737b87d46521e5bf082138f251eb3018966821 (diff) |
* marshal.c (r_symreal): register the symbol name first so that
r_symlink always returns valid names. [Bug #10991]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1272,7 +1272,9 @@ r_symreal(struct load_arg *arg, int ivar) int idx = -1; st_index_t n = arg->symbols->num_entries; - st_insert(arg->symbols, (st_data_t)n, (st_data_t)0); + if (rb_enc_str_asciionly_p(s)) rb_enc_associate_index(s, ENCINDEX_US_ASCII); + id = rb_intern_str(s); + st_insert(arg->symbols, (st_data_t)n, (st_data_t)id); if (ivar) { long num = r_long(arg); while (num-- > 0) { @@ -1282,7 +1284,6 @@ r_symreal(struct load_arg *arg, int ivar) } if (idx > 0) rb_enc_associate_index(s, idx); id = rb_intern_str(s); - st_insert(arg->symbols, (st_data_t)n, (st_data_t)id); return id; } |