Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2689B10F3B for ; Tue, 30 Dec 2014 22:26:17 +0000 (UTC) Received: (qmail 76823 invoked by uid 500); 30 Dec 2014 22:26:17 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 76793 invoked by uid 500); 30 Dec 2014 22:26:17 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 76781 invoked by uid 99); 30 Dec 2014 22:26:17 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Dec 2014 22:26:17 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 6A5F2AC092E; Tue, 30 Dec 2014 22:26:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1648612 - /subversion/trunk/subversion/libsvn_fs_fs/tree.c Date: Tue, 30 Dec 2014 22:26:17 -0000 To: commits@subversion.apache.org From: stefan2@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141230222617.6A5F2AC092E@hades.apache.org> Author: stefan2 Date: Tue Dec 30 22:26:17 2014 New Revision: 1648612 URL: http://svn.apache.org/r1648612 Log: Follow-up to r1648591: Fix a similar segfault in the DAG walk code. * subversion/libsvn_fs_fs/tree.c (open_path): We must always take the iteration start node HERE from the node path walked so far. CHILD may live in ITERPOOL and must never be directly assigned to HERE anymore. This actually simplifies the iteration logic. Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1648612&r1=1648611&r2=1648612&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Tue Dec 30 22:26:17 2014 @@ -1020,15 +1020,12 @@ open_path(parent_path_t **parent_path_p, path_so_far->len += strlen(entry) + 1; path_so_far->data[path_so_far->len] = '\0'; - if (*entry == '\0') - { - /* Given the behavior of svn_fs__next_entry_name(), this - happens when the path either starts or ends with a slash. - In either case, we stay put: the current directory stays - the same, and we add nothing to the parent path. */ - child = here; - } - else + /* Given the behavior of svn_fs__next_entry_name(), ENTRY may be an + empty string when the path either starts or ends with a slash. + In either case, we stay put: the current directory stays the + same, and we add nothing to the parent path. We only need to + process non-empty path segments. */ + if (*entry != '\0') { copy_id_inherit_t inherit; const char *copy_path = NULL; @@ -1076,12 +1073,8 @@ open_path(parent_path_t **parent_path_p, if (flags & open_path_node_only) { - /* Shortcut: the caller only wants the final DAG node. - Make sure CHILD, which will become HERE, and the node - we will ultimately return survive the cleanup of - ITERPOOL. */ - child = svn_fs_fs__dag_copy_into_pool(child, pool); - parent_path->node = child; + /* Shortcut: the caller only wants the final DAG node. */ + parent_path->node = svn_fs_fs__dag_copy_into_pool(child, pool); } else { @@ -1112,7 +1105,10 @@ open_path(parent_path_t **parent_path_p, apr_psprintf(iterpool, _("Failure opening '%s'"), path)); rest = next; - here = child; + + /* The NODE in PARENT_PATH equals CHILD but lives in POOL, i.e. + * it will survive the cleanup of ITERPOOL.*/ + here = parent_path->node; } svn_pool_destroy(iterpool);