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

ruby-changes:39407

From: nobu <ko1@a...>
Date: Wed, 5 Aug 2015 14:38:17 +0900 (JST)
Subject: [ruby-changes:39407] nobu:r51488 (trunk): transcode.c: fix dangling pointers

nobu	2015-08-05 14:37:58 +0900 (Wed, 05 Aug 2015)

  New Revision: 51488

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

  Log:
    transcode.c: fix dangling pointers
    
    * transcode.c (rb_econv_open0): rb_econv_t::source_encoding_name
      and rb_econv_t::destination_encoding_name should refer static
      strings always or NULL.  [ruby-core:70247] [Bug #11416]

  Modified files:
    trunk/ChangeLog
    trunk/transcode.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51487)
+++ ChangeLog	(revision 51488)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Aug  5 14:37:55 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* transcode.c (rb_econv_open0): rb_econv_t::source_encoding_name
+	  and rb_econv_t::destination_encoding_name should refer static
+	  strings always or NULL.  [ruby-core:70247] [Bug #11416]
+
 Tue Aug  4 16:53:43 2015  Aaron Patterson <tenderlove@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): extract callback
Index: transcode.c
===================================================================
--- transcode.c	(revision 51487)
+++ transcode.c	(revision 51488)
@@ -993,6 +993,7 @@ rb_econv_open0(const char *sname, const https://github.com/ruby/ruby/blob/trunk/transcode.c#L993
     if (*sname == '\0' && *dname == '\0') {
         num_trans = 0;
         entries = NULL;
+	sname = dname = "";
     }
     else {
         struct trans_open_t toarg;
@@ -3246,10 +3247,10 @@ rb_econv_init_by_convpath(VALUE self, VA https://github.com/ruby/ruby/blob/trunk/transcode.c#L3247
     }
 
     if (first) {
-      *senc_p = NULL;
-      *denc_p = NULL;
-      *sname_p = "";
-      *dname_p = "";
+	*senc_p = NULL;
+	*denc_p = NULL;
+	*sname_p = "";
+	*dname_p = "";
     }
 
     ec->source_encoding_name = *sname_p;

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

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