[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: Wed, 24 Sep 2008 13:09:58 +0100

On Wed, 2008-09-24 at 10:49 +0200, Stefan Küng wrote:
> Julian Foad wrote:
> > 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?
>
> I haven't tested on Linux, but I assume that if it would crash with
> forward-slash paths, that would have been noticed immediately.
>
> A windows path has a colon and a slash (e.g., C:/) which I think is
> interpreted by apr as an url part, and I'd say that's the reason why
> apr_uri_parse doesn't return with an error.

On my copy of APR (v1.2.2), apr_uri_parse("C:/") gives {scheme = 0x0,
hostinfo = 0x0, user = 0x0, password = 0x0, hostname = 0x0, port_str =
0x0, path = 0x8080e50 "C:/", query = 0x0, fragment = 0x0, hostent = 0x0,
port = 0, is_initialized = 1, dns_looked_up = 0, dns_resolved = 0}.

- Julian

> > 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
>
> Yes, scheme field was valid (containing only the drive letter), but
> hostname was NULL which lead to the segfault in the for-loop below.
>
> > 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.
>
> I'm using apr 1.3.3 and apr-util 1.3.4. Maybe that has something to do
> with this?
> I'm currently in the office, so I can't investigate this further until I
> get home.
>
> Stefan
>

---------------------------------------------------------------------
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-24 14:10:16 CEST

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