Project

General

Profile

Actions

Bug #14206

closed

Null-byte ignored inside class/module/method bodies

Added by grddev (Gustav Munkby) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin14]
[ruby-core:84349]

Description

I would have expected the following code to not be accepted by the Ruby parser, but instead it acts as if the zero-byte wasn't part of the string.

eval("def m\n\0end")

Changing to a block to start with begin

eval("begin\n\0end")

Produces the expected syntax error

SyntaxError: (eval):2: syntax error, unexpected end-of-input
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r61346.


parse.y: end of script at newline

  • parse.y (parser_yylex): deal with end of script chars just after
    ignored newline as other places. [ruby-core:84349] [Bug #14206]

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED

It's a bug since 1.9, by "fluent style".

Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED to 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r62847 merged revision(s) 61346.

Updated by usa (Usaku NAKAMURA) about 6 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE

ruby_2_3 r62938 merged revision(s) 61346.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0