diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-08-20 01:43:04 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-08-20 10:06:16 +0900 |
commit | d2483393cbcb4dcfa0000fa8166bb7fa7ed9f7b4 (patch) | |
tree | 5db32cf5e09b6aaddf4161e37e81d4cd961a71b8 /sprintf.c | |
parent | 8f4a53d0517a99e57060211a3efe2d7a9d5d06b2 (diff) |
[Bug #18956] Negative codepoints are invalid characters
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6259
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 4 |
1 files changed, 2 insertions, 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"); |