summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-07 16:07:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-07 16:07:25 +0000
commita7c4146d9cf747792b52cec383ab4d58a0f2b0f9 (patch)
treecb2509c1d8d4a22a25ff3d17491532181160ff03
parentfd7a02f9600edb4a98498ceb23441a54257f462f (diff)
parse.y: fix invalid char in eval
* parse.y (parser_yylex): fix invalid char in eval, should raise an syntax error too, as well as directly coded. [ruby-core:64243] [Bug #10117] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_parse.rb5
3 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 48d219fa73..bc3ecaf842 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Aug 8 01:07:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): fix invalid char in eval, should raise
+ an syntax error too, as well as directly coded.
+ [ruby-core:64243] [Bug #10117]
+
Thu Aug 7 23:25:29 2014 Masaki Matsushita <glass.saga@gmail.com>
* lib/open3.rb: avoid unnecessary write if stdin_data is empty.
diff --git a/parse.y b/parse.y
index 0ac8ea6890..72617d28fc 100644
--- a/parse.y
+++ b/parse.y
@@ -8266,7 +8266,7 @@ parser_yylex(struct parser_params *parser)
default:
if (!parser_is_identchar()) {
- rb_compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
+ compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
goto retry;
}
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 8f957bbc58..008dbbcd92 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -657,8 +657,11 @@ x = __ENCODING__
end
def test_invalid_char
+ bug10117 = '[ruby-core:64243] [Bug #10117]'
+ invalid_char = /Invalid char `\\x01'/
x = 1
- assert_equal(1, eval("\x01x"))
+ assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117)
+ assert_syntax_error("\x01x", invalid_char, bug10117)
assert_equal(nil, eval("\x04x"))
end