summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-21 13:52:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-21 13:52:49 +0000
commit1f26578da0fa056a58030abd231732d19e59492e (patch)
tree019925dee38cedbf6dcafab39d7c9a6c24065252 /parse.y
parentc49ad1c40dde6da0404bb31e8e07740336d96cdd (diff)
* parse.y (dsym): prohibit empty symbol literal by interpolation.
fixed: [ruby-talk:166529] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y9
1 files changed, 8 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index dd0e46b99b..aafc821a87 100644
--- a/parse.y
+++ b/parse.y
@@ -2143,12 +2143,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;