You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/09/06 23:54:29 UTC

svn commit: r1622944 - /subversion/trunk/subversion/libsvn_repos/replay.c

Author: stefan2
Date: Sat Sep  6 21:54:28 2014
New Revision: 1622944

URL: http://svn.apache.org/r1622944
Log:
Fix a segfault in our replay logic when presented with corrupted changed
path lists that try to add root nodes. 

* subversion/libsvn_repos/replay.c
  (path_driver_cb_func): We can never add a directory or file at "/".

Modified:
    subversion/trunk/subversion/libsvn_repos/replay.c

Modified: subversion/trunk/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/replay.c?rev=1622944&r1=1622943&r2=1622944&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/replay.c (original)
+++ subversion/trunk/subversion/libsvn_repos/replay.c Sat Sep  6 21:54:28 2014
@@ -548,6 +548,17 @@ path_driver_cb_func(void **dir_baton,
       svn_boolean_t src_readable;
       svn_fs_root_t *copyfrom_root;
 
+      /* E.g. when verifying corrupted repositories, their changed path
+         lists may contain an ADD for "/".  The delta path driver will
+         call us with a NULL parent in that case. */
+      if (*edit_path == 0)
+        return svn_error_create(SVN_ERR_FS_ALREADY_EXISTS, NULL,
+                                _("Root directory already exists."));
+
+      /* A NULL parent_baton will cause a segfault.  It should never be
+          NULL for non-root paths. */
+      SVN_ERR_ASSERT(parent_baton);
+
       /* Was this node copied? */
       SVN_ERR(fill_copyfrom(&copyfrom_root, &copyfrom_path, &copyfrom_rev,
                             &src_readable, root, change,