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

RE: [RFC] Passing invalid uri to svn_ra_reparent causes JVM to abort when using JavaHL library (javahl-ra branch)

From: Bert Huijben <bert_at_qqmail.nl>
Date: Sun, 24 Jun 2012 21:36:51 +0200

Hi,

 

Could you please send your e-mails to this list in plain text?

That makes it much easier to answer in-line.

 

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).

 

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

 

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.

 

                Bert

 

From: vladimir_at_berezniker.com [mailto:vladimir_at_berezniker.com] On Behalf Of Vladimir Berezniker
Sent: zondag 24 juni 2012 19:18
To: dev_at_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
Received on 2012-06-24 21:37:36 CEST

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.