Project

General

Profile

Backport #8220

Segmentation fault when providing defined? operator with empty parentheses

Added by RossDavidSmith (Ross Smith) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:53999]

Description

=begin
Reproducing steps:

  • Execute the code: (({defined? ()}))

Ruby version:

  • ((%ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]%))

Expected result:

  • Expected the same error as ruby 1.9.3: ((%syntax error, unexpected ')'%))

Actual result:

  • Ruby crashed with the attached error log: =end

Files

error_log.txt (10 KB) error_log.txt RossDavidSmith (Ross Smith), 04/05/2013 01:01 AM

Related issues

Follows Ruby master - Bug #8224: defined?(()) and defined? () are inconsistentClosed04/05/2013Actions

Associated revisions

Revision 0c5d73e8
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 40124
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Revision 40124
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Revision 40124
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Revision 40124
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Revision 40124
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Revision 40124
Added by nobu (Nobuyoshi Nakada) over 6 years ago

compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Revision ed1d6660
Added by nagachika (Tomoyuki Chikanaga) over 6 years ago

merge revision(s) 40124: [Backport #8220]

    * compile.c (iseq_compile_each): fix of defined? with empty
      expression.  [ruby-core:53999] [Bug #8220]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 40312
Added by nagachika (Tomoyuki Chikanaga) over 6 years ago

merge revision(s) 40124: [Backport #8220]

* compile.c (iseq_compile_each): fix of defined? with empty
  expression.  [ruby-core:53999] [Bug #8220]

History

#1

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40124.
Ross, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


compile.c: defined? with empty expression

  • compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220]

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

Hello, nobu.

r40124 fixes a segv but defined? () behaves like defined? nil.
How do you think to raise SyntaxError for defined? () (as 1.9.3).

Thanks,

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

The parenthesis is interpreted differently between 2.0 and earlier, it
was "interpreted as grouped expression" till 1.9. That warning has
been removed in 2.0 and now that syntax can be accepted.

That is, the error was a restriction in older versions, and I think
it's not worth replicating.

#4

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)

nobu, thank you for your explanation.
I understand the fix depends on an existing incompatibility between 2.0 and 1.9.x.
I'll merge r40124 to ruby_2_0_0.

#5

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r40312.
Ross, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 40124: [Backport #8220]

* compile.c (iseq_compile_each): fix of defined? with empty
  expression.  [ruby-core:53999] [Bug #8220]

Also available in: Atom PDF