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

ruby-changes:52355

From: usa <ko1@a...>
Date: Mon, 27 Aug 2018 23:15:49 +0900 (JST)
Subject: [ruby-changes:52355] usa:r64563 (ruby_2_4): merge revision(s) 64071: [Backport #14941]

usa	2018-08-27 23:15:43 +0900 (Mon, 27 Aug 2018)

  New Revision: 64563

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

  Log:
    merge revision(s) 64071: [Backport #14941]
    
    ruby.c: taint ARGV on Windows
    
    * ruby.c (external_str_new_cstr): strings come from the external
      should be tainted.  [ruby-dev:50596] [Bug #14941]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/ruby.c
    branches/ruby_2_4/test/ruby/test_rubyoptions.rb
    branches/ruby_2_4/version.h
Index: ruby_2_4/test/ruby/test_rubyoptions.rb
===================================================================
--- ruby_2_4/test/ruby/test_rubyoptions.rb	(revision 64562)
+++ ruby_2_4/test/ruby/test_rubyoptions.rb	(revision 64563)
@@ -920,4 +920,11 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_rubyoptions.rb#L920
       end
     end
   end
+
+  def test_argv_tainted
+    assert_separately(%w[- arg], "#{<<~"begin;"}\n#{<<~'end;'}")
+    begin;
+      assert_predicate(ARGV[0], :tainted?, '[ruby-dev:50596] [Bug #14941]')
+    end;
+  end
 end
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 64562)
+++ ruby_2_4/version.h	(revision 64563)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.5"
 #define RUBY_RELEASE_DATE "2018-08-27"
-#define RUBY_PATCHLEVEL 320
+#define RUBY_PATCHLEVEL 321
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_4/ruby.c
===================================================================
--- ruby_2_4/ruby.c	(revision 64562)
+++ ruby_2_4/ruby.c	(revision 64563)
@@ -2069,7 +2069,9 @@ external_str_new_cstr(const char *p) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/ruby.c#L2069
 {
 #if UTF8_PATH
     VALUE str = rb_utf8_str_new_cstr(p);
-    return str_conv_enc(str, NULL, rb_default_external_encoding());
+    str = str_conv_enc(str, NULL, rb_default_external_encoding());
+    OBJ_TAINT_RAW(str);
+    return str;
 #else
     return rb_external_str_new_cstr(p);
 #endif
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 64562)
+++ ruby_2_4	(revision 64563)

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r64071

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

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