Project

General

Profile

Actions

Bug #11663

closed

Segfault when using multiple keywords if the first keyword is invalid

Added by smacgahan (Sean MacGahan) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:71356]

Description

When loading a method with an invalid keyword (such as one that ends in a question mark), a syntax error occurs as is expected. However, when loading a method with multiple keywords, if the first keyword is invalid then a segmentation fault occurs.

def foo(arg1?:) end         #=> syntax error
def foo(arg1?:, arg2) end   #=> syntax error (tIDENTIFIER as expected)
def foo(arg1:) end          #=> no syntax error
def foo(arg1:, arg2?:) end  #=> syntax error
def foo(arg1, arg2?:) end   #=> syntax error

def foo(arg1?:, arg2:) end  #=> segfault
def foo(arg1?:, arg2?:) end #=> segfault

Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #10440: Optimize keyword and splat argumentClosedko1 (Koichi Sasada)10/28/2014Actions
Related to Ruby master - Bug #10545: SEGV: def m(A: a) endClosed11/26/2014Actions
Actions #1

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed

Applied in changeset r52461.


parse.y: fix segv after invalid keyword argument

  • parse.y (kwd_append): fix segv after invalid keyword argument,
    preceding keyword list is NULL when syntax error is there.
    [ruby-core:71356] [Bug #11663]

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Description updated (diff)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Related to Feature #10440: Optimize keyword and splat argument added
Actions #4

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Related to Bug #10545: SEGV: def m(A: a) end added

Updated by nagachika (Tomoyuki Chikanaga) about 9 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE

Backported into ruby_2_2 branch at r52742.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0