More differential fuzzing bugs: 2

オープン
#4,481 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, ruby
領域
compilers

調査の方向性

The report gives Ruby reproduction commands comparing parse.y and Prism for each discrepancy, but names no source files or tests. Start by running the listed commands with both parsers and identify which cases fail in Prism; then trace each failure to its parser code and regression tests. Done means Prism matches parse.y across all reported crash, semantic, syntax, and encoding cases.

索引モデルが issue の本文から書いたものです。

説明

New findings from differential (parse.y vs Prism) and invariant fuzzing against upstream Prism a5e01d818fa45f2cea9232754251a6855f82ab98 / CRuby ruby 4.1.0dev (2026-11-25T22:05:35Z HEAD f46d41a54c) +PRISM.


Crash

  • PRISM_ASSERT abort in parse_write on self=&->.self=self=

    Reproduction
    ruby --parser=parse.y -ce 'self=&->.self=self='
    ruby --parser=prism   -ce 'self=&->.self=self='
    
    • parse.y: reports SyntaxError (Can't change the value of self / syntax error, unexpected &)
    • prism: aborts with assertion failure in parse_write:
      src/prism.c:13837: parse_write: Assertion `pm_parser_local_depth_constant_id(parser, name) == (int) depth' failed.
      [BUG] Aborted
      

Runtime / Semantic Discrepancies

  • Wrong operator precedence on 4-C::F!do end&.()

    Reproduction
    ruby --parser=parse.y -e 'module C; def self.F!; ->{ 1 }; end; end; p(4-C::F!do end&.())'
    ruby --parser=prism   -e 'module C; def self.F!; ->{ 1 }; end; end; p(4-C::F!do end&.())'
    
    • parse.y: 3 — parses as 4 - (C::F! do end&.())
    • prism: TypeError: Proc can't be coerced into Integer — parses as (4 - C::F! do end)&.()
  • Heredoc followed by line continuation (\\\n) misparses RHS of []|=

    Reproduction
    printf 'a = {}; def b(x = nil); [:b, x]; end\na[<<HEREDOC]|=b\\\nHEREDOC\n%%()\np a\n' | ruby --parser=parse.y
    printf 'a = {}; def b(x = nil); [:b, x]; end\na[<<HEREDOC]|=b\\\nHEREDOC\n%%()\np a\n' | ruby --parser=prism
    
    • parse.y: {"" => true} — parses RHS as b("") (%() is an argument to b)
    • prism: NoMethodError: undefined method '%' for an instance of Array — parses RHS as b % ()
  • Named regexp capture in CESU-8 creates a local variable in Prism but not in parse.y

    Reproduction
    printf '#coding:CESU-8\n/(?<\\ueee5>)/=~"a"\np local_variables\n' | ruby --parser=parse.y
    printf '#coding:CESU-8\n/(?<\\ueee5>)/=~"a"\np local_variables\n' | ruby --parser=prism
    
    • parse.y: [] (0 locals)
    • prism: [:"\uEEE5"] (1 local)

Syntax Acceptance / Rejection Discrepancies

  • `alias<<`` at EOF accepted by Prism

    Reproduction
    printf 'alias<<`' | ruby --parser=parse.y -c
    printf 'alias<<`' | ruby --parser=prism   -c
    
    • parse.y: SyntaxError: unterminated here document identifier
    • prism: Syntax OK
  • Heredoc followed by line continuation (\\\n) in modifier rescue hides unterminated heredoc

    Reproduction
    printf 'if t\nend\n<<HEREDOC rescue a\\\nHEREDOC\n<<H' | ruby --parser=parse.y -c
    printf 'if t\nend\n<<HEREDOC rescue a\\\nHEREDOC\n<<H' | ruby --parser=prism   -c
    
    • parse.y: SyntaxError: can't find string "H" anywhere before EOF
    • prism: Syntax OK
  • Literal \u{\n} inside string in CP1257 encoding accepted by Prism

    Reproduction
    printf '#coding:CP1257\nf"\\u{\\n}" ' | ruby --parser=parse.y -c
    printf '#coding:CP1257\nf"\\u{\\n}" ' | ruby --parser=prism   -c
    
    • parse.y: SyntaxError: invalid Unicode escape
    • prism: Syntax OK
  • def f(*)rescue*,();end rejected by Prism

    Reproduction
    ruby --parser=parse.y -ce 'def f(*)rescue*,();end'
    ruby --parser=prism   -ce 'def f(*)rescue*,();end'
    
    • parse.y: Syntax OK
    • prism: SyntaxError: expected an expression after '*'
  • #coding:IBM850\na'\x8A':?\u3042 rejected by Prism as invalid_symbol

    Reproduction
    printf '#coding:IBM850\na\x27\x8a\x27:?\\u3042 ' | ruby --parser=parse.y -c
    printf '#coding:IBM850\na\x27\x8a\x27:?\\u3042 ' | ruby --parser=prism   -c
    
    • parse.y: Syntax OK
    • prism: SyntaxError: invalid symbol
  • #coding:iso8859-1\nx=?\xa0^() accepted by Prism

    Reproduction
    printf '#coding:iso8859-1\nx=?\xa0^()' | ruby --parser=parse.y -c
    printf '#coding:iso8859-1\nx=?\xa0^()' | ruby --parser=prism   -c
    
    • parse.y: SyntaxError: syntax error, unexpected '?'
    • prism: Syntax OK

Magic Comment / Encoding Discrepancy

  • Encoding mismatch on #\x03:"coding:Windows-31J\\ at EOF

    Reproduction
    printf '#\x03:"coding:Windows-31J\\' | ruby --parser=parse.y -e 'RubyVM.keep_script_lines = true; p RubyVM::InstructionSequence.compile(STDIN.read).script_lines.first.encoding'
    printf '#\x03:"coding:Windows-31J\\' | ruby --parser=prism   -e 'RubyVM.keep_script_lines = true; p RubyVM::InstructionSequence.compile(STDIN.read).script_lines.first.encoding'
    
    • parse.y: #<Encoding:Windows-31J>
    • prism: #<Encoding:UTF-8>
主要言語
C
スター
1k
フォーク
206
平均マージ
1日 1時間
マージ済み PR(30日)
71

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/prism のほかの issue

ruby/prism の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。