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

Re: Segfault during "svn info"

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sun, 16 Nov 2008 20:10:26 +0200 (Jerusalem Standard Time)

> > $ svn cleanup
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 47116375701120 (LWP 8732)]
> > 0x00002ada2100e056 in svn_uri_is_canonical (
> > uri=0x6653b0 "svn+ssh://svn@10.0.1.1")
> > at subversion/libsvn_subr/dirent_uri.c:1029
> > 1029 while (*ptr != '/')
>
> From reading the code, it looks like we are running over the end
> of that string into uninitialised memory.
>
> Jens, can you try this patch?
> And can someone other than Jens try this patch on windows?
>

How to try this patch? Shall I just apply it and run dirent_uri-tests.exe?
(Should we add svn:// | file:// test cases to that file?)

Daniel
(whose svn+tau:///reposname setup ignores the hostname part, which
should make testing easier.)

> Index: subversion/libsvn_subr/dirent_uri.c
> ===================================================================
> --- subversion/libsvn_subr/dirent_uri.c (revision 34203)
> +++ subversion/libsvn_subr/dirent_uri.c (working copy)
> @@ -1026,7 +1026,7 @@ svn_uri_is_canonical(const char *uri)
>
> /* Found a hostname, check that it's all lowercase. */
> ptr = seg;
> - while (*ptr != '/')
> + while (*ptr && *ptr != '/')
> {
> if (*ptr >= 'A' && *ptr <= 'Z')
> return FALSE;
> @@ -1036,13 +1036,16 @@ svn_uri_is_canonical(const char *uri)
> }
>
> #if defined(WIN32) || defined(__CYGWIN__)
> - /* If this is a file url, ptr now points to the third '/' in
> - file:///C:/path. Check that if we have such a URL the drive
> - letter is in uppercase. */
> - if (strncmp(uri, "file:", 5) == 0 &&
> - ! (*(ptr+1) >= 'A' && *(ptr+1) <= 'Z') &&
> - *(ptr+2) == ':')
> - return FALSE;
> + if (*ptr == '/')
> + {
> + /* If this is a file url, ptr now points to the third '/' in
> + file:///C:/path. Check that if we have such a URL the drive
> + letter is in uppercase. */
> + if (strncmp(uri, "file:", 5) == 0 &&
> + ! (*(ptr+1) >= 'A' && *(ptr+1) <= 'Z') &&
> + *(ptr+2) == ':')
> + return FALSE;
> + }
> #endif /* WIN32 or Cygwin */
>
> /* Now validate the rest of the URI. */
>
> Thanks,
> 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-11-16 19:10:42 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.