Project

General

Profile

Actions

Backport #8220

closed

Segmentation fault when providing defined? operator with empty parentheses

Added by RossDavidSmith (Ross Smith) about 11 years ago. Updated about 11 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 open1 closed)

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

Updated by nobu (Nobuyoshi Nakada) about 11 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

Updated by nagachika (Tomoyuki Chikanaga) about 11 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) about 11 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.

Actions #4

Updated by nagachika (Tomoyuki Chikanaga) about 11 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.

Actions #5

Updated by nagachika (Tomoyuki Chikanaga) about 11 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0