[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] avoid loggy SEGV

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 17 Sep 2009 20:34:44 +0100

On Thu, Sep 17, 2009 at 11:42:29AM -0700, Dave Brown wrote:
> I am not sure if error code SVN_ERR_BAD_RELATIVE_PATH is correct
> here, but seems reasonable.
>
> [[[
> Raise an error in log.c when given paths that are not in the WC, rather
> than letting the code segfault. (Absolute paths in /tmp seem to be
> coming from merge operations). Callers of loggy_path() are not prepared
> to handle a NULL return anyway. Even though this stuff is going away,
> it is crashing midway through the javahl tests. With this change,
> the javahl tests complete, getting 1 error and 2 failures.
>
> * subversion/libsvn_wc/log.c
> (loggy_path): return svn_error if path is not a child of
> adm_abspath
> ]]]
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2396145

> Index: subversion/libsvn_wc/log.c
> ===================================================================
> --- subversion/libsvn_wc/log.c (revision 39409)
> +++ subversion/libsvn_wc/log.c (working copy)
> @@ -1727,9 +1727,14 @@
> SVN_ERR(svn_dirent_get_absolute(&abspath, path, pool));
> *logy_path = svn_dirent_is_child(adm_abspath, abspath, NULL);
>
> - if (! (*logy_path) && strcmp(abspath, adm_abspath) == 0)
> + if (! (*logy_path) ) {

This does not conform to our coding style.
Should be:

  if (! (*logy_path))
    {
      ...
    }

The fix looks right to me otherwise.
The docstring says "PATH must not be outside that directory" so
raising an error if that's the case is perfectly fine.

Thanks!

     . o O (maybe this variable should be called "loggy_path"?)
Stefan

> + if (strcmp(abspath, adm_abspath) == 0) /* same path */
> *logy_path = SVN_WC_ENTRY_THIS_DIR;
> -
> + else /* not a child path */
> + return svn_error_createf(SVN_ERR_BAD_RELATIVE_PATH, NULL,
> + "path '%s' not a child of '%s'\n",
> + path, adm_abspath);
> + }
> return SVN_NO_ERROR;
> }
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2396168
Received on 2009-09-17 21:35:01 CEST

This is an archived mail posted to the Subversion Dev mailing list.