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 11 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 :))
Actions

Also available in: PDF Atom