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

Re: svn commit: r33254 - trunk/subversion/libsvn_subr

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 23 Sep 2008 22:24:46 +0100

On Tue, 2008-09-23 at 10:20 -0700, steveking_at_tigris.org wrote:
> Author: steveking
> Date: Tue Sep 23 10:20:15 2008
> New Revision: 33254
>
> Log:
> Prevent segfault when Windows paths with forward slashes are passed.
>
> * subversion/libsvn_subr/path.c
> (svn_path_canonicalize): only treat the path as an URI if the hostname is
> valid.

I'm trying to understand this change. What is an example of a path that
made it seg-fault? Do you know why it seg-faults on Windows but not un
Linux?

Presumably, given that this fixes it, apr_uri_parse() was returning the
scheme as valid but NULL for the hostname field. I see that the APR
documentation for apr_uri_parse() and apr_uri_t does not specify whether
these returned fields will be null or will be empty strings or may be
either, so I suppose our code should cope with anything. Most fields are
coming back as null in some quick tests, but hostname comes back as an
empty string if I pass "file:///path".

The new code concludes that a valid scheme and a null hostname means the
path is a local path. That seems odd.

- Julian

> Modified:
> trunk/subversion/libsvn_subr/path.c
>
> Modified: trunk/subversion/libsvn_subr/path.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/path.c?pathrev=33254&r1=33253&r2=33254
> ==============================================================================
> --- trunk/subversion/libsvn_subr/path.c Tue Sep 23 07:41:22 2008 (r33253)
> +++ trunk/subversion/libsvn_subr/path.c Tue Sep 23 10:20:15 2008 (r33254)
> @@ -1290,7 +1290,7 @@ svn_path_canonicalize(const char *path,
>
> /* Try to parse the path as an URI. */
> if (apr_uri_parse(pool, path, &host_uri) == APR_SUCCESS &&
> - host_uri.scheme)
> + host_uri.scheme && host_uri.hostname)
> {
> /* convert scheme and hostname to lowercase */
> apr_size_t offset;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-23 23:25:06 CEST

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