Project

General

Profile

Actions

Bug #22516

open

Emacs-Mule accepts a code point whose first byte is below 0x80 in format("%c")

Bug #22516: Emacs-Mule accepts a code point whose first byte is below 0x80 in format("%c")

Added by mame (Yusuke Endoh) 1 day ago. Updated 1 day ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127368]

Description

format("%c") in Emacs-Mule accepts a code point that Integer#chr rejects, and writes more bytes than it allocated.

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") #=> #<RangeError: invalid codepoint 0x1018000 in Emacs-Mule> (as expected)
Actions

Also available in: PDF Atom