You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bert Huijben <be...@qqmail.nl> on 2011/08/03 12:16:43 UTC

RE: svn commit: r1153416 - /subversion/trunk/subversion/libsvn_wc/status.c


> -----Original Message-----
> From: ivan@apache.org [mailto:ivan@apache.org]
> Sent: woensdag 3 augustus 2011 12:10
> To: commits@subversion.apache.org
> Subject: svn commit: r1153416 -
> /subversion/trunk/subversion/libsvn_wc/status.c
> 
> Author: ivan
> Date: Wed Aug  3 10:10:22 2011
> New Revision: 1153416
> 
> URL: http://svn.apache.org/viewvc?rev=1153416&view=rev
> Log:
> Fix access to uninitialized variable.
> 
> * subversion/libsvn_wc/status.c
>   (internal_status): Do not access NODE_STATUS if read_info() function
>    returned error.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/status.c
> 
> Modified: subversion/trunk/subversion/libsvn_wc/status.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/stat
> us.c?rev=1153416&r1=1153415&r2=1153416&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/status.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/status.c Wed Aug  3 10:10:22
> 2011
> @@ -2464,21 +2464,24 @@ internal_status(svn_wc_status3_t **statu
>                               db, local_abspath,
>                               scratch_pool, scratch_pool);
> 
> -  if ((err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
> -      || node_status == svn_wc__db_status_not_present
> -      || node_status == svn_wc__db_status_server_excluded
> -      || node_status == svn_wc__db_status_excluded)
> +  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)

Did you get an error from this if somehow?
(Or via a analysis tool)

We use this pattern in a lot more places, in cases like r = (s != NULL) ? s->var : NULL, and that is safe in C and most other languages that use the same evaluation rules.

And even if it wouldn't be safe for evaluation reasons this test wouldn't have a problem because any value of node_status would be ok to have the same result.

	Bert 



RE: svn commit: r1153416 - /subversion/trunk/subversion/libsvn_wc/status.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Bert Huijben [mailto:bert@qqmail.nl]
> Sent: woensdag 3 augustus 2011 12:17
> To: Ivan Zhakov
> Cc: dev@subversion.apache.org
> Subject: RE: svn commit: r1153416 -
> /subversion/trunk/subversion/libsvn_wc/status.c
> 
> 
> 
> > -----Original Message-----
> > From: ivan@apache.org [mailto:ivan@apache.org]
> > Sent: woensdag 3 augustus 2011 12:10
> > To: commits@subversion.apache.org
> > Subject: svn commit: r1153416 -
> > /subversion/trunk/subversion/libsvn_wc/status.c
> >
> > Author: ivan
> > Date: Wed Aug  3 10:10:22 2011
> > New Revision: 1153416
> >
> > URL: http://svn.apache.org/viewvc?rev=1153416&view=rev
> > Log:
> > Fix access to uninitialized variable.
> >
> > * subversion/libsvn_wc/status.c
> >   (internal_status): Do not access NODE_STATUS if read_info() function
> >    returned error.
> >
> > Modified:
> >     subversion/trunk/subversion/libsvn_wc/status.c
> >
> > Modified: subversion/trunk/subversion/libsvn_wc/status.c
> > URL:
> >
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/stat
> > us.c?rev=1153416&r1=1153415&r2=1153416&view=diff
> >
> ==========================================================
> > ====================
> > --- subversion/trunk/subversion/libsvn_wc/status.c (original)
> > +++ subversion/trunk/subversion/libsvn_wc/status.c Wed Aug  3 10:10:22
> > 2011
> > @@ -2464,21 +2464,24 @@ internal_status(svn_wc_status3_t **statu
> >                               db, local_abspath,
> >                               scratch_pool, scratch_pool);
> >
> > -  if ((err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
> > -      || node_status == svn_wc__db_status_not_present
> > -      || node_status == svn_wc__db_status_server_excluded
> > -      || node_status == svn_wc__db_status_excluded)
> > +  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
> 
> Did you get an error from this if somehow?
> (Or via a analysis tool)

Forget this mail, or actually the previous one. I didn't look further then the if (err ||)

Sorry.

	Bert