Project

General

Profile

This project is closed and read-only.

Actions

Backport #8220

closed

Segmentation fault when providing defined? operator with empty parentheses

Backport #8220: Segmentation fault when providing defined? operator with empty parentheses

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


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 1 (0 open — 1 closed)

Follows Ruby - Bug #8224: defined?(()) and defined? () are inconsistentClosedActions

Updated by nobu (Nobuyoshi Nakada) over 13 years ago Actions #1

  • 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 13 years ago Actions #2 [ruby-core:54038]

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 13 years ago Actions #3 [ruby-core:54057]

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.

Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago Actions #4

  • Tracker changed from Bug to Backport
  • Project changed from Ruby to 15
  • 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.

Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago Actions #5

  • 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]
Actions

Also available in: PDF Atom