From: "steviejj (Steven Johnstone) via ruby-core" Date: 2026-11-17T14:56:21+00:00 Subject: [ruby-core:127557] [Ruby Bug#22558] parse.y dereferences NULL in evstr2dstr when `%I`/`%W` word concatenation fails on mixed encodings Issue #22558 has been reported by steviejj (Steven Johnstone). ---------------------------------------- Bug #22558: parse.y dereferences NULL in evstr2dstr when `%I`/`%W` word concatenation fails on mixed encodings https://bugs.ruby-lang.org/issues/22558 * Author: steviejj (Steven Johnstone) * Status: Open * ruby -v: ruby 4.0.9 (2026-10-23 revision 3e93b23afc) +PRISM [arm64-darwin27] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- ``` ruby -e 'STDOUT.binmode; STDOUT.write("#coding:sjis\n%I \xE2\xE2\xE20\\u0400 ".b)' | ruby --parser=parse.y -c - -:2: invalid multibyte char (Windows-31J) -:2: string literal encodings differ (Windows-31J / UTF-8) -:2: unterminated list meets end of file %I ���������0\u0400 ruby: [BUG] Segmentation fault at 0x0000000000000000 ruby 4.0.9 (2026-10-23 revision 3e93b23afc) [arm64-darwin27] -- Crash Report log information -------------------------------------------- See Crash Report log file in one of the following locations: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. -- Control frame information ----------------------------------------------- c:0001 p:0000 s:0003 E:001110 l:y b:---- DUMMY [FINISH] -- Threading information --------------------------------------------------- Total ractor count: 1 Ruby thread count for this ractor: 1 -- Machine register context ------------------------------------------------ x0: 0x0000000102158c10 x1: 0x0000000000000000 x2: 0x000000010214f00e x3: 0x0000000000000001 x4: 0x0000000000000001 x5: 0x0000000000000200 x6: 0x000000000000000a x7: 0xffffffffb00007ff x18: 0x0000000000000000 x19: 0x0000000102158c10 x20: 0x000000000000028e x21: 0x000000016ef892d0 x22: 0x000000016ef88680 x23: 0x000000000000017f x24: 0x000000016ef898ec x25: 0x0000000000000000 x26: 0x0000000000000384 x27: 0x0000000101e14902 x28: 0x0000000101dcbdd2 lr: 0x0000000101ac41c0 fp: 0x000000016ef89ad0 sp: 0x000000016ef88440 -- C level backtrace information ------------------------------------------- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(rb_vm_bugreport+0x374) [0x101bbba2c] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(rb_bug_for_fatal_signal) [0x101a46198] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(sigabrt) [0x101b3816c] /usr/lib/system/libsystem_platform.dylib(_sigtramp+0x38) [0x18bcac144] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(ruby_yyparse) [0x101ac41c0] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(yycompile0) [0x101ad1358] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(rb_suppress_tracing) [0x101bbcfb4] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(rb_parser_compile) [0x101acfba8] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(parser_compile) [0x101b2e328] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(rb_parser_compile_file_path) [0x101b2d38c] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(load_file_internal) [0x101b2a048] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(rb_ec_ensure) [0x101a4e2e8] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(ruby_process_options) [0x101b2939c] /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib(ruby_options) [0x101a4cf20] /opt/homebrew/Cellar/ruby/4.0.9/bin/ruby(main+0x64) [0x100e755a4] -- Other runtime information ----------------------------------------------- * Loaded script: ruby * Ruby Box: disabled * Loaded features: 0 enumerator.so 1 thread.rb 2 fiber.so 3 rational.so 4 complex.so 5 pathname.so 6 ruby2_keywords.rb 7 set.rb 8 /opt/homebrew/Cellar/ruby/4.0.9/lib/ruby/4.0.0/arm64-darwin27/enc/encdb.bundle 9 /opt/homebrew/Cellar/ruby/4.0.9/lib/ruby/4.0.0/arm64-darwin27/enc/trans/transdb.bundle 10 /opt/homebrew/Cellar/ruby/4.0.9/lib/ruby/4.0.0/arm64-darwin27/enc/windows_31j.bundle * Process memory map: 100e88000-100e90000 r-- /opt/homebrew/Cellar/ruby/4.0.9/bin/ruby 100e90000-100e94000 r-- /opt/homebrew/Cellar/ruby/4.0.9/bin/ruby 100e94000-100ed4000 rw- /opt/homebrew/Cellar/ruby/4.0.9/bin/ruby 101260000-10148c000 --- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 10148c000-101570000 rw- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 101570000-101574000 r-- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 101574000-10157c000 rw- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 10158c000-10171c000 --- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 10171c000-101774000 rw- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 101774000-1017f4000 rw- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 102128000-10212c000 --- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 10212c000-10252c000 rw- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 10252c000-102530000 --- /opt/homebrew/Cellar/ruby/4.0.9/lib/libruby.4.0.dylib 131600000-131604000 rw- 7258000000-7258400000 rw- 77aa800000-77aac00000 rw- 77aac00000-77ab000000 rw- 77ab000000-77ab400000 rw- 77ab400000-77ab800000 rw- 77ab800000-77abc00000 rw- [IMPORTANT] Don't forget to include the Crash Report log file under DiagnosticReports directory in bug reports. [1] 18937 done ruby -e | 18938 segmentation fault ruby --parser=parse.y -c - ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/