[前][次][番号順一覧][スレッド一覧]

ruby-changes:28868

From: nobu <ko1@a...>
Date: Sat, 25 May 2013 08:58:46 +0900 (JST)
Subject: [ruby-changes:28868] nobu:r40920 (trunk): string.c: check argument type

nobu	2013-05-25 08:58:35 +0900 (Sat, 25 May 2013)

  New Revision: 40920

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40920

  Log:
    string.c: check argument type
    
    * string.c (rb_str_quote_unprintable): check if argument is a string.

  Modified files:
    trunk/ChangeLog
    trunk/string.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40919)
+++ ChangeLog	(revision 40920)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May 25 08:58:23 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (rb_str_quote_unprintable): check if argument is a string.
+
 Fri May 24 19:32:00 2013  Charlie Somerville  <charliesome@r...>
 
 	* variable.c (set_const_visibility): use rb_frame_this_func() instead
Index: string.c
===================================================================
--- string.c	(revision 40919)
+++ string.c	(revision 40920)
@@ -8152,8 +8152,10 @@ rb_str_quote_unprintable(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L8152
     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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]