Project

General

Profile

Bug #11663

Segfault when using multiple keywords if the first keyword is invalid

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

Status:
Closed
Priority:
Normal
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

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

Associated revisions

Revision dfa75017
Added by nobu (Nobuyoshi Nakada) about 4 years ago

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]

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

Revision 52461
Added by nobu (Nobuyoshi Nakada) about 4 years ago

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]

Revision 52461
Added by nobu (Nobuyoshi Nakada) about 4 years ago

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]

Revision 52461
Added by nobu (Nobuyoshi Nakada) about 4 years ago

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]

Revision 52461
Added by nobu (Nobuyoshi Nakada) about 4 years ago

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]

Revision 52461
Added by nobu (Nobuyoshi Nakada) about 4 years ago

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]

Revision 0ec0eb9c
Added by nagachika (Tomoyuki Chikanaga) about 4 years ago

merge revision(s) 52461: [Backport #11663]

    * 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]

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

Revision 52742
Added by nagachika (Tomoyuki Chikanaga) about 4 years ago

merge revision(s) 52461: [Backport #11663]

* 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]

History

#1

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

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

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

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

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

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

Also available in: Atom PDF