On Sun, Jun 24, 2012 at 3:36 PM, Bert Huijben <b...@qqmail.nl> wrote:
>
> Hi,
>
>
>
> Could you please send your e-mails to this list in plain text?
>
> That makes it much easier to answer in-line.

Noted.

>
>
>
> I would recommend canonicalizing the uris before passing them to the 
> function. That should fix most if not all problems in this error class.
>
> svn_uri_canonicalize for urls, svn_relpath_canonicalize and 
> svn_dirent_canonicalize for local paths (or maybe svn_dirent_internal_style() 
> if you want ‘\’ to ‘/’ conversion on Windows).
>

Looking at the code for the above functions I do not see how running
the svn_uri_canonicalize would provide any indication that URI is
invalid so that I can raise an exception to the caller.

>
>
> Note that assert() is only fatal in debug/maintainer builds. In release 
> builds these checks are removed.
>

Noted.

>
>
> SVN_ERR_ASSERT() can be turned into reporting an error on initialization, 
> which might be a good route for JavaHL. In SharpSvn (for .Net) I make the 
> assertion callback throw a C++ exception, which can then be caught by callers 
> higher in the chain as a .Net exception, while the C++ exception handling 
> makes sure the pools are cleaned up while clearing the stack.

Interesting, I'll take a look at what you have done in SharpSvn. But I
need to think about it some more.  I can see how hooking the assert
could help identify code paths that are not properly handled. But I do
not see why I should allow the  calling code to trigger assert for a
known use case.  In this case URI could be coming directly from a
person, it would be nice to be able to just return standard SVN error
telling the caller than they got an invalid URI. I am not saying that
it how it should be, just that is the behavior  I would have expected
from JavaHL if I was a user of it.

>
>
>
>                 Bert
>

Thank you for your help,

Vladimir

>
>
> From: vladi...@berezniker.com [mailto:vladi...@berezniker.com] On Behalf Of 
> Vladimir Berezniker
> Sent: zondag 24 juni 2012 19:18
> To: dev@subversion.apache.org
> Subject: [RFC] Passing invalid uri to svn_ra_reparent causes JVM to abort 
> when using JavaHL library (javahl-ra branch)
>
>
>
> Hi All,
>
>
>
> While implementing svn_ra_reparent() function in JavaHL, I created a test that
>
> sends string "BAD" uri to the reparent function (I am trying to make sure
>
> JavaHL can't take the JVM down).  This causes segfault inside
>
> uri_skip_ancestor() function of the line 1483 of the dirent_uri.c file:
>
>
>
>   assert(svn_uri_is_canonical(child_uri, NULL));
>
>
>
> which is called from svn_uri_skip_ancestor() function.
>
>
>
> It seems a bit harsh to kill the whole JVM because caller passed a poorly
>
> formed URI to a function, but I am not quite sure what would be the right way 
> of
>
> addressing this. If someone could point me in a right direction I'll prepare a
>
> patch for review.
>
>
>
> Thank you,
>
>
>
> Vladimir

Reply via email to