You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2011/08/03 12:10:23 UTC

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/status.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)
     {
       svn_error_clear(err);
       node_kind = svn_wc__db_kind_unknown;
-
       /* Ensure conflicted is always set, but don't hide tree conflicts
          on 'hidden' nodes. */
-      if (err)
-        conflicted = FALSE;
+      conflicted = FALSE;
+    }
+  else if (err)
+    {
+        return svn_error_trace(err);
+    }
+  else if (node_status == svn_wc__db_status_not_present
+           || node_status == svn_wc__db_status_server_excluded
+           || node_status == svn_wc__db_status_excluded)
+    {
+      node_kind = svn_wc__db_kind_unknown;
     }
-  else
-    SVN_ERR(err);
 
   if (node_kind == svn_wc__db_kind_unknown)
     return svn_error_trace(assemble_unversioned(status,



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
 



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

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

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