[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: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-01-30 15:51:10 CET

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.

> *o*r, if you take the docstring "
> * @a revision must be of kind @c svn_opt_revision_number,
> * @c svn_opt_revision_head, or @c svn_opt_revision_date. If
> * @a revision does not meet these requirements, return the error
> * @c SVN_ERR_CLIENT_BAD_REVISION.
> "
> literally, then
> 2. A NULL revision argument should cause us to return
> SVN_ERR_CLIENT_BAD_REVISION, which your patch does not.

I don't think "does not meet these requirements" was intended to include
"revision" being null. The text should perhaps be tweaked a bit - maybe to say
"@a revision->kind".

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 30 16:00:19 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.