1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sprintf.c (rb_str_format): check if codepoint for %c is valid.

[ruby-dev:36691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-10-09 18:41:35 +00:00
parent 017ff9bfa2
commit 94355e2984
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Oct 10 03:41:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_str_format): check if codepoint for %c is valid.
[ruby-dev:36691]
Fri Oct 10 01:55:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_names): minor improvement.

View file

@ -618,7 +618,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
c = NUM2INT(val);
}
n = rb_enc_codelen(c, enc);
if (n == 0) {
if (n <= 0) {
rb_raise(rb_eArgError, "invalid character");
}
if (!(flags & FWIDTH)) {