Project

General

Profile

Actions

Bug #22601

closed

parse.y fails to skip a bare 3-byte UTF-8 BOM

Bug #22601: parse.y fails to skip a bare 3-byte UTF-8 BOM

Added by steviejj (Steven Johnstone) about 19 hours ago. Updated about 12 hours ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.9 (2026-10-23 revision 3e93b23afc) +PRISM [arm64-darwin27]
[ruby-core:127583]

Description

Very minor divergence between prism and parse.y spotted in differential fuzzing. Tested on

ruby 4.0.9 (2026-10-23 revision 3e93b23afc) +PRISM [aarch64-linux] and ruby 4.1.0dev (2026-11-18T09:19:17Z HEAD ed3e747aa4) +PRISM [aarch64-linux].

Executing a 3-byte .rb file containing only the BOM ("\xEF\xBB\xBF") or evaluating it with eval:

ruby --parser=parse.y -e 'eval("\xEF\xBB\xBF")'
# => (eval at -e:1):1:in '<main>': undefined local variable or method '' for main (NameError)  (exit 1)

ruby --parser=prism -e 'eval("\xEF\xBB\xBF")'
# => (exits 0)
ruby -e 'pp RubyVM::AbstractSyntaxTree.parse("\xEF\xBB\xBF")'
(SCOPE@1:0-1:3 tbl: [] args: nil body: (VCALL@1:0-1:3 :))

Updated by nobu (Nobuyoshi Nakada) about 13 hours ago Actions #1

  • Backport changed from 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED

Updated by nobu (Nobuyoshi Nakada) about 12 hours ago Actions #2

  • Status changed from Open to Closed

Applied in changeset git|e5e6cd45db456b2a4d368f2a34598641319df630.


[Bug #22601] Skip BOM-only input

Actions

Also available in: PDF Atom