Skip to content

Commit e552b9a

Browse files
committed
merge revision(s) r47098: [Backport ruby#10117]
* parse.y (parser_yylex): fix invalid char in eval, should raise an syntax error too, as well as directly coded. [ruby-core:64243] [Bug ruby#10117] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 7a1fdd6 commit e552b9a

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Mon Aug 25 00:36:56 2014 Nobuyoshi Nakada <[email protected]>
2+
3+
* parse.y (parser_yylex): fix invalid char in eval, should raise
4+
an syntax error too, as well as directly coded.
5+
[ruby-core:64243] [Bug #10117]
6+
17
Mon Aug 25 00:26:12 2014 Nobuyoshi Nakada <[email protected]>
28

39
* parse.y (parser_yyerror): preserve source code encoding in

parse.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8090,7 +8090,7 @@ parser_yylex(struct parser_params *parser)
80908090

80918091
default:
80928092
if (!parser_is_identchar()) {
8093-
rb_compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
8093+
compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
80948094
goto retry;
80958095
}
80968096

test/ruby/test_parse.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,11 @@ def test_invalid_class_variable
658658
end
659659

660660
def test_invalid_char
661+
bug10117 = '[ruby-core:64243] [Bug #10117]'
662+
invalid_char = /Invalid char `\\x01'/
661663
x = 1
662-
assert_equal(1, eval("\x01x"))
664+
assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117)
665+
assert_syntax_error("\x01x", invalid_char, bug10117)
663666
assert_equal(nil, eval("\x04x"))
664667
end
665668

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-08-25"
3-
#define RUBY_PATCHLEVEL 208
3+
#define RUBY_PATCHLEVEL 209
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 8

0 commit comments

Comments
 (0)