diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-13 06:43:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-13 06:43:18 +0000 |
commit | 5b56c1c42bb4745d2c05b8ed01734146e6e7ef44 (patch) | |
tree | 746417762980348811f1ed93d614df4156aeb94e /parse.y | |
parent | bb7ae984f8ae63083dde38587f4a562271856f52 (diff) | |
download | ruby-5b56c1c42bb4745d2c05b8ed01734146e6e7ef44.tar.gz |
parse.y: attrset from junk ID
* parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.
* parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also
attrset ID. [ruby-core:60668] [Bug #8756]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -10222,7 +10222,7 @@ rb_enc_symname_p(const char *name, rb_encoding *enc) } #define IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST)) -#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<ID_SCOPE_MASK) & ~(1U<<ID_ATTRSET)) +#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET)) static int rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset) @@ -10309,7 +10309,8 @@ rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int a if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1; type = ID_JUNK; ++m; - break; + if (m + 1 < e || *m != '=') break; + /* fall through */ case '=': if (!(allowed_attrset & (1U << type))) return -1; type = ID_ATTRSET; |