Author: breser
Date: Sat Feb 22 01:32:01 2014
New Revision: 1570778

URL: http://svn.apache.org/r1570778
Log:
BDB: Convert a silent propogation of corrupted keys into an assertion.

The callers don't bother to check for this condition.  It shouldn't ever happen
and if it does something has gone terribly awry.  Just run our malfunction
handler to avoid making a bigger mess.

* subversion/libsvn_fs_base/key-gen.c
  (svn_fs_base__next_key): Just assert instead of returning an empty string.

Modified:
    subversion/trunk/subversion/libsvn_fs_base/key-gen.c

Modified: subversion/trunk/subversion/libsvn_fs_base/key-gen.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/key-gen.c?rev=1570778&r1=1570777&r2=1570778&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/key-gen.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/key-gen.c Sat Feb 22 01:32:01 
2014
@@ -46,12 +46,9 @@ svn_fs_base__next_key(const char *this, 
                                  incrementing the number, after all. */
 
   /* Empty strings and leading zeros (except for the string "0") are not
-     allowed */
-  if (olen == 0 || (olen > 1 && this[0] == '0'))
-    {
-      *len = 0;
-      return;
-    }
+   * allowed.  Run our malfunction handler to prevent possible db corruption
+   * from being propagated further. */
+  SVN_ERR_ASSERT_NO_RETURN(olen != 0 && (olen == 1 || this[0] != '0'));
 
   i = olen - 1; /* initial index: we work backwords */
   while (1729)


Reply via email to