From: "mame (Yusuke Endoh) via ruby-core" Date: 2026-11-09T08:17:39+00:00 Subject: [ruby-core:127369] [Ruby Bug#22516] Emacs-Mule accepts a code point whose first byte is below 0x80 in format("%c") Issue #22516 has been updated by mame (Yusuke Endoh). https://github.com/ruby/ruby/pull/19792 ---------------------------------------- Bug #22516: Emacs-Mule accepts a code point whose first byte is below 0x80 in format("%c") https://bugs.ruby-lang.org/issues/22516#change-119804 * Author: mame (Yusuke Endoh) * Status: Open * Backport: 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- `format("%c")` in Emacs-Mule accepts a code point that `Integer#chr` rejects, and writes more bytes than it allocated. ```ruby fmt = ("a" * 100 + "%c").force_encoding("Emacs-Mule") p format(fmt, 0x01018000) # expected: ArgumentError (invalid character) # actual: "aaa...aaa\x01\x01" (the other 2 bytes "\x80\x00" of the character are written past the buffer) p 0x01018000.chr("Emacs-Mule") #=> # (as expected) ``` -- 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/