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
- 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
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,
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.
- 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.
- 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
Like0
Like0Like0Like0Like0Like0