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

ruby-changes:29016

From: nagachika <ko1@a...>
Date: Wed, 5 Jun 2013 00:10:15 +0900 (JST)
Subject: [ruby-changes:29016] nagachika:r41068 (ruby_2_0_0): merge revision(s) 40925: [Backport #8451]

nagachika	2013-06-05 00:09:53 +0900 (Wed, 05 Jun 2013)

  New Revision: 41068

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

  Log:
    merge revision(s) 40925: [Backport #8451]
    
    * dir.c (bracket): fix copy-paste error.  When the first and last
      characters of fnmatch range have different length, fnmatch may
      have wrongly matched a path that does not really match.
      Coverity Scan found this bug.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/dir.c
    branches/ruby_2_0_0/test/ruby/test_fnmatch.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41067)
+++ ruby_2_0_0/ChangeLog	(revision 41068)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Wed Jun  5 00:08:55 2013  Yusuke Endoh  <mame@t...>
+
+	* dir.c (bracket): fix copy-paste error.  When the first and last
+	  characters of fnmatch range have different length, fnmatch may
+	  have wrongly matched a path that does not really match.
+	  Coverity Scan found this bug.
+
 Wed Jun  5 00:04:12 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_quote_unprintable): check if argument is a string.
Index: ruby_2_0_0/dir.c
===================================================================
--- ruby_2_0_0/dir.c	(revision 41067)
+++ ruby_2_0_0/dir.c	(revision 41068)
@@ -137,7 +137,7 @@ bracket( https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/dir.c#L137
 	    p = t2 + (r2 = rb_enc_mbclen(t2, pend, enc));
 	    if (ok) continue;
 	    if ((r <= (send-s) && memcmp(t1, s, r) == 0) ||
-		(r2 <= (send-s) && memcmp(t2, s, r) == 0)) {
+		(r2 <= (send-s) && memcmp(t2, s, r2) == 0)) {
 		ok = 1;
 		continue;
 	    }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41067)
+++ ruby_2_0_0/version.h	(revision 41068)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-06-05"
-#define RUBY_PATCHLEVEL 205
+#define RUBY_PATCHLEVEL 206
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_0_0/test/ruby/test_fnmatch.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_fnmatch.rb	(revision 41067)
+++ ruby_2_0_0/test/ruby/test_fnmatch.rb	(revision 41068)
@@ -124,4 +124,9 @@ class TestFnmatch < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_fnmatch.rb#L124
       assert(File.fnmatch("{*,#{pattern_eucjp}}", path, File::FNM_EXTGLOB))
     end
   end
+
+  def test_unicode
+    assert_file.fnmatch("[a-\u3042]*", "\u3042")
+    assert_file.not_fnmatch("[a-\u3042]*", "\u3043")
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40925


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

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