1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

symbol.c (rb_sym2id): do not return garbage object

The dynamic sym passed to rb_sym2id may be a garbage object
(as accounted for by dsymbol_check).  This fixes an occasional
segfault in "make test-all" for me.

No need to backport, this is from the new symbol GC feature.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2014-08-30 10:30:00 +00:00
parent 42e5ff998b
commit 765e4e2ea6
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Sat Aug 30 19:22:47 2014 Eric Wong <e@80x24.org>
* symbol.c (rb_sym2id): do not return garbage object
Sat Aug 30 06:39:48 2014 Aaron Patterson <aaron@tenderlovemaking.com> Sat Aug 30 06:39:48 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/yaml_tree.rb: fix NameError dumping and * ext/psych/lib/psych/visitors/yaml_tree.rb: fix NameError dumping and

View file

@ -759,7 +759,7 @@ rb_sym2id(VALUE sym)
} }
else { else {
if (!SYMBOL_PINNED_P(sym)) { if (!SYMBOL_PINNED_P(sym)) {
dsymbol_pindown(sym); return dsymbol_pindown(sym);
} }
return (ID)sym; return (ID)sym;
} }