Project

General

Profile

Actions

Bug #14690

closed

Invalid CMDARG state after command_args followed by tLBRACE_ARG

Added by ibylich (Ilya Bylich) about 6 years ago. Updated about 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-04-15 trunk 63161) [x86_64-darwin17]
[ruby-core:86551]

Description

assert_valid_syntax('let () { m(a) do; end }')

The patch that fixes it is attached.

tLBRACE_ARG does "CMDARG_PUSH(0)" in the lexer and then the parser leaves the "command_args" rule. The parser does "CMDARG_POP" to remove 1 from the top of the "CMDARG", but the thing here is that there's a 0 on top (the one pushed by tLBRACE_ARG) and the parser pops a wrong value. If the next token is tLBRACE_ARG the parser should pop 2nd top value (like "tmp = pop; pop; push(tmp)").

From what I understand that's the only token that can mutate "CMDARG" in the lexer and that can be emitted after command args.

I've found it during stress-testing a parser gem and that's the only issue that I was able to find so far.


Files

Actions #1

Updated by nobu (Nobuyoshi Nakada) about 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63168.


parse.y: fix cmdarg in command_args

  • parse.y (call_args): fix invalid CMDARG state after command_args
    followed by tLBRACE_ARG. [ruby-core:86551] [Bug #14690]

From: Ilya Bylich

Updated by whitequark (whitequark *) about 6 years ago

Will this be backported and if yes to which versions?

Actions #4

Updated by nobu (Nobuyoshi Nakada) about 6 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0