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

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

From: Bert Huijben <bert_at_qqmail.nl>
Date: Wed, 3 Aug 2011 12:16:43 +0200

> -----Original Message-----
> From: ivan_at_apache.org [mailto:ivan_at_apache.org]
> Sent: woensdag 3 augustus 2011 12:10
> To: commits_at_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
Received on 2011-08-03 12:17:24 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.