diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-21 13:52:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-21 13:52:49 +0000 |
commit | cc24146adc931f1797c8469faa9fa9e68c8d4a47 (patch) | |
tree | 352d9e94f3903f55ca9506ca43df942c584ee8de /parse.y | |
parent | e4b2293712c52b089aa5e179a1b3d5571e93e733 (diff) | |
download | ruby-cc24146adc931f1797c8469faa9fa9e68c8d4a47.tar.gz |
* parse.y (dsym): prohibit empty symbol literal by interpolation.
fixed: [ruby-talk:166529]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -3864,12 +3864,19 @@ dsym : tSYMBEG xstring_contents tSTRING_END yyerror("empty symbol literal"); } else { + VALUE lit; + switch (nd_type($$)) { case NODE_DSTR: nd_set_type($$, NODE_DSYM); break; case NODE_STR: - if (strlen(RSTRING($$->nd_lit)->ptr) == RSTRING($$->nd_lit)->len) { + lit = $$->nd_lit; + if (RSTRING(lit)->len == 0) { + yyerror("empty symbol literal"); + break; + } + if (strlen(RSTRING(lit)->ptr) == RSTRING(lit)->len) { $$->nd_lit = ID2SYM(rb_intern(RSTRING($$->nd_lit)->ptr)); nd_set_type($$, NODE_LIT); break; |