subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1405772 - in /subversion/trunk/subversion: include/svn_error_codes.h libsvn_subr/named_atomic.c
Date Mon, 05 Nov 2012 12:40:49 GMT
Author: stefan2
Date: Mon Nov  5 12:40:49 2012
New Revision: 1405772

URL: http://svn.apache.org/viewvc?rev=1405772&view=rev
Log:
Instead of trying to sanitize externally corrupted data, simply error
out as soon as we detect a corruption like that.

* subversion/include/svn_error_codes.h
  (SVN_ERR_CORRUPTED_ATOMIC_STORAGE): new error code
* subversion/libsvn_subr/named_atomic.c
  (svn_atomic_namespace__create): bail out whenever we detect a corruption

Modified:
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/libsvn_subr/named_atomic.c

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=1405772&r1=1405771&r2=1405772&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Mon Nov  5 12:40:49 2012
@@ -1425,6 +1425,11 @@ SVN_ERROR_START
              SVN_ERR_MISC_CATEGORY_START + 37,
              "failed to parse version number string")
 
+  /** @since New in 1.8. */
+  SVN_ERRDEF(SVN_ERR_CORRUPTED_ATOMIC_STORAGE,
+             SVN_ERR_MISC_CATEGORY_START + 38,
+             "Atomic data storage is corrupt")
+
   /* command-line client errors */
 
   SVN_ERRDEF(SVN_ERR_CL_ARG_PARSING_ERROR,

Modified: subversion/trunk/subversion/libsvn_subr/named_atomic.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/named_atomic.c?rev=1405772&r1=1405771&r2=1405772&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/named_atomic.c (original)
+++ subversion/trunk/subversion/libsvn_subr/named_atomic.c Mon Nov  5 12:40:49 2012
@@ -462,10 +462,12 @@ svn_atomic_namespace__create(svn_atomic_
 
   if (!err && new_ns->data)
     {
-      /* Sanitize (in case of data corruption)
+      /* Detect severe cases of corruption (i.e. when some outsider messed
+       * with our data file)
        */
       if (new_ns->data->count > MAX_ATOMIC_COUNT)
-        new_ns->data->count = MAX_ATOMIC_COUNT;
+        return svn_error_create(SVN_ERR_CORRUPTED_ATOMIC_STORAGE, 0,
+                       _("Number of atomics in namespace is too large."));
 
       /* Cache the number of existing, complete entries.  There can't be
        * incomplete ones from other processes because we hold the mutex.



Mime
View raw message