Skip to content

Commit

Permalink
Allow null byte in double-quoted string. fix #1358
Browse files Browse the repository at this point in the history
  • Loading branch information
repeatedly committed Apr 26, 2017
1 parent 491049b commit ae5a501
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/fluent/config/literal_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def eval_escape_char(c)
"\f"
when "b"
"\b"
when "0"
"\0"
when /[a-zA-Z0-9]/
parse_error! "unexpected back-slash escape character '#{c}'"
else # symbols
Expand Down
2 changes: 1 addition & 1 deletion test/config/test_literal_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def test_falseX
test('"\\.t"') { assert_text_parsed_as(".t", '"\\.t"') }
test('"\\$t"') { assert_text_parsed_as("$t", '"\\$t"') }
test('"\\"') { assert_text_parsed_as("#t", '"\\#t"') }
test('"\\0"') { assert_text_parsed_as("\0", '"\\0"') }
test('"\\z"') { assert_parse_error('"\\z"') } # unknown escaped character
test('"\\0"') { assert_parse_error('"\\0"') } # unknown escaped character
test('"\\1"') { assert_parse_error('"\\1"') } # unknown escaped character
test('"t') { assert_parse_error('"t') } # non-terminated quoted character
test("\"t\nt\"") { assert_text_parsed_as("t\nt", "\"t\nt\"" ) } # multiline string
Expand Down

0 comments on commit ae5a501

Please sign in to comment.