subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1341273 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
Date Mon, 21 May 2012 23:46:42 GMT
Author: stefan2
Date: Mon May 21 23:46:41 2012
New Revision: 1341273

URL: http://svn.apache.org/viewvc?rev=1341273&view=rev
Log:
Don't assume that all changed paths have been fully normalized.

* subversion/libsvn_fs_fs/fs_fs.c
  (fetch_all_changes): Improve robustness.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1341273&r1=1341272&r2=1341273&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Mon May 21 23:46:41 2012
@@ -4852,9 +4852,16 @@ fetch_all_changes(apr_hash_t *changed_pa
           apr_hash_index_t *hi;
 
           /* a potential child path must contain at least 2 more chars
-             (the path separator plus at least one char for the name)
+             (the path separator plus at least one char for the name).
+             Also, we should not assume that all paths have been normalized
+             i.e. some might have trailing path separators.
           */
-          apr_ssize_t min_child_len = strlen(change->path) + 2;
+          apr_ssize_t change_path_len = strlen(change->path);
+          apr_ssize_t min_child_len = change_path_len == 0
+                                    ? 1
+                                    : change->path[change_path_len-1] == '/'
+                                        ? change_path_len + 1
+                                        : change_path_len + 2;
 
           /* CAUTION: This is the inner loop of an O(n^2) algorithm.
              The number of changes to process may be >> 1000.



Mime
View raw message