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

Re: [PATCH] Fixing possible segmentation fault

From: Alexander Thomas <alexander_at_collab.net>
Date: 2006-02-02 13:08:59 CET

On Mon, 2006-01-30 at 07:56 -0600, kfogel@collab.net wrote:
> Julian Foad <julianfoad@btopenworld.com> writes:
> > Daniel Berlin wrote:
> > > Alexander Thomas wrote:
> > >>svn_client_checkout2() fails with segmentation fault, if called with a
> > >>revision argument as NULL. IMHO revision should be checked for NULL
> > >>before using it further.
> > > This is wrong in one of two ways.
> > > Either
> > > 1. We instead should just assert that revision != NULL, like we do for URL.
> > > Nobody should be passing in a NULL revision to this function.
> >
> > +1 on this. The general rule is that you must not pass a null pointer
> > to any API unless its documentation says you may, and in this case it
> > does not say so.
>
> I agree with Julian and Daniel here, but also, what was the context?
> Did you find someone passing NULL for that parameter? (I.e., is there
> some larger issue that needs correcting?)
>
I don't know about anyone passing NULL, I am culprit here.

I passed NULL because I don't have a revision to pass. I know about the
svn_opt_revision_unspecified and how to pass it, but was bit lazy and
never though NULL could have break svn_client_checkout2().

I strongly feel that asserting revision (also peg revision) parameter
will be good idea, because in the wild people can do all sorts of nasty
things to our API.

Please comment

-AT

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 2 13:12:01 2006

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.