summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-29 04:43:10 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-29 04:43:10 +0000
commit847b7bcfb3db371acb552200913e5302c3759796 (patch)
tree45bb640145b58048241889940beb54d2cb6b3d1a /marshal.c
parented737b87d46521e5bf082138f251eb3018966821 (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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index a0630cb35c..4cf4edc88b 100644
--- a/marshal.c
+++ b/marshal.c
@@ -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;
}