You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Küng <st...@gmx.ch> on 2005/08/15 18:25:31 UTC

svn_client_lock() segfaults with empty paths

Hi,

Crashreport analyze time for TSVN again ;)

While doing that, I found that svn_client_lock() segfaults if the first 
param (const apr_array_header_t *) contains zero elements, i.e. if no 
paths to lock are passed to the function.

I know I should not call svn_client_lock() if there's nothing to lock at 
all in TSVN, so I can get rid of the crashreports I receive on my own. 
But still, I think Subversion shouldn't segfault in such a case.

The reason for the crash:
svn_client_lock()
   organize_lock_targets()
    svn_path_condense_targets()

svn_path_condense_targets() returns NULL for 'common_parent' without an 
error code. Then, in the next lines:

   if (apr_is_empty_array (rel_targets))
     {
/* here's the segfault, because *common_parent is NULL!
       char *base_name = svn_path_basename (*common_parent, pool);
       *common_parent = svn_path_dirname (*common_parent, pool);

       APR_ARRAY_PUSH (rel_targets, char *) = base_name;
     }

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn_client_lock() segfaults with empty paths

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 15 Aug 2005, Stefan Küng wrote:

> Crashreport analyze time for TSVN again ;)
>
> While doing that, I found that svn_client_lock() segfaults if the first
> param (const apr_array_header_t *) contains zero elements, i.e. if no
> paths to lock are passed to the function.
>
> I know I should not call svn_client_lock() if there's nothing to lock at
> all in TSVN, so I can get rid of the crashreports I receive on my own.
> But still, I think Subversion shouldn't segfault in such a case.
>
I agree.  It also follows the pattern of svn_client_mkdir2, which returns
no error on an empty targets list.

Fixed in r15734 and nominated for 1.2.x.

Thanks for the report,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org