[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: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Wed, 24 Sep 2008 10:49:43 +0200

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.

> 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

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

Received on 2008-09-24 10:50:05 CEST

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