[ruby-core:84349] [Ruby trunk Bug#14206] Null-byte ignored inside class/module/method bodies

From: grddev@...
Date: 2017-12-19 15:37:19 UTC
List: ruby-core #84349
Issue #14206 has been reported by grddev (Gustav Munkby).

----------------------------------------
Bug #14206: Null-byte ignored inside class/module/method bodies
https://bugs.ruby-lang.org/issues/14206

* Author: grddev (Gustav Munkby)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin14]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
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.

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

Changing to a block to start with begin

~~~ ruby
eval("begin\n\0end")
~~~

Produces the expected syntax error

~~~
SyntaxError: (eval):2: syntax error, unexpected end-of-input
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next