mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #18956] Negative codepoints are invalid characters
This commit is contained in:
parent
8f4a53d051
commit
d2483393cb
Notes:
git
2022-08-20 10:06:37 +09:00
2 changed files with 3 additions and 2 deletions
|
@ -447,8 +447,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||
goto format_s1;
|
||||
}
|
||||
else {
|
||||
c = NUM2INT(val);
|
||||
n = rb_enc_codelen(c, enc);
|
||||
n = NUM2INT(val);
|
||||
if (n >= 0) n = rb_enc_codelen((c = n), enc);
|
||||
}
|
||||
if (n <= 0) {
|
||||
rb_raise(rb_eArgError, "invalid character");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue