diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-24 23:58:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-24 23:58:35 +0000 |
commit | 165db57cdc91ba422448b1be228a9f70bff08f15 (patch) | |
tree | 166a5312ab08a9e809bb45e487b08d85b4915553 | |
parent | 10a726d9e35308a40f478afceed58e6186366637 (diff) |
string.c: check argument type
* string.c (rb_str_quote_unprintable): check if argument is a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | string.c | 4 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Sat May 25 08:58:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * string.c (rb_str_quote_unprintable): check if argument is a string. + Fri May 24 19:32:00 2013 Charlie Somerville <charliesome@ruby-lang.org> * variable.c (set_const_visibility): use rb_frame_this_func() instead @@ -8152,8 +8152,10 @@ rb_str_quote_unprintable(VALUE str) rb_encoding *enc; const char *ptr; long len; - rb_encoding *resenc = rb_default_internal_encoding(); + rb_encoding *resenc; + Check_Type(str, T_STRING); + resenc = rb_default_internal_encoding(); if (resenc == NULL) resenc = rb_default_external_encoding(); enc = STR_ENC_GET(str); ptr = RSTRING_PTR(str); |