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

ruby-changes:29013

From: nagachika <ko1@a...>
Date: Tue, 4 Jun 2013 23:47:25 +0900 (JST)
Subject: [ruby-changes:29013] nagachika:r41065 (ruby_2_0_0): merge revision(s) 39637,40900: [Backport #8440]

nagachika	2013-06-04 23:47:15 +0900 (Tue, 04 Jun 2013)

  New Revision: 41065

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

  Log:
    merge revision(s) 39637,40900: [Backport #8440]
    
    load.c: reorder conditions
    
    * load.c (loaded_feature_path): reorder conditions so simple
      comparision comes first.
    * load.c (loaded_feature_path): fix invalid read by index underflow.
      the beginning of name is also a boundary as well as just after '/'.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/load.c
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41064)
+++ ruby_2_0_0/ChangeLog	(revision 41065)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue Jun  4 23:42:18 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* load.c (loaded_feature_path): fix invalid read by index underflow.
+	  the beginning of name is also a boundary as well as just after '/'.
+
 Tue Jun  4 23:32:12 2013  Charlie Somerville  <charliesome@r...>
 
 	* variable.c (set_const_visibility): use rb_frame_this_func() instead
Index: ruby_2_0_0/load.c
===================================================================
--- ruby_2_0_0/load.c	(revision 41064)
+++ ruby_2_0_0/load.c	(revision 41065)
@@ -315,7 +315,7 @@ loaded_feature_path(const char *name, lo https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/load.c#L315
 
     if (vlen < len+1) return 0;
     if (!strncmp(name+(vlen-len), feature, len)) {
-	plen = vlen - len - 1;
+	plen = vlen - len;
     }
     else {
 	for (e = name + vlen; name != e && *e != '.' && *e != '/'; --e);
@@ -323,16 +323,20 @@ loaded_feature_path(const char *name, lo https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/load.c#L323
 	    e-name < len ||
 	    strncmp(e-len, feature, len))
 	    return 0;
-	plen = e - name - len - 1;
+	plen = e - name - len;
     }
-    if (type == 's' && !IS_DLEXT(&name[plen+len+1])
-     || type == 'r' && !IS_RBEXT(&name[plen+len+1])
-     || name[plen] != '/') {
-       return 0;
+    if (plen > 0 && name[plen-1] != '/') {
+	return 0;
+    }
+    if (type == 's' ? !IS_DLEXT(&name[plen+len]) :
+	type == 'r' ? !IS_RBEXT(&name[plen+len]) :
+	0) {
+	return 0;
     }
     /* Now name == "#{prefix}/#{feature}#{ext}" where ext is acceptable
        (possibly empty) and prefix is some string of length plen. */
 
+    if (plen > 0) --plen;	/* exclude '.' */
     for (i = 0; i < RARRAY_LEN(load_path); ++i) {
 	VALUE p = RARRAY_PTR(load_path)[i];
 	const char *s = StringValuePtr(p);
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41064)
+++ ruby_2_0_0/version.h	(revision 41065)
@@ -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-04"
-#define RUBY_PATCHLEVEL 203
+#define RUBY_PATCHLEVEL 204
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 6

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39637,40900


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

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