You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/01/27 12:12:36 UTC

svn commit: r1726995 - /subversion/trunk/subversion/libsvn_fs_fs/pack.c

Author: stefan2
Date: Wed Jan 27 11:12:36 2016
New Revision: 1726995

URL: http://svn.apache.org/viewvc?rev=1726995&view=rev
Log:
Fix an interger overflow in the FSFS packing code on /trunk.
Older releases are not affected.

Found by: philipm

* subversion/libsvn_fs_fs/pack.c
  (roundness): The return value for 0 could be anything but 0 is
               apparently the more consistent and robust choice.
               There is effectively no change in the caller logic
               because having no predecessors still makes those
               nodes a "likely head".  No longer being a "likely
               target" due to a high roundness value is then
               inconsequential.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/pack.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/pack.c?rev=1726995&r1=1726994&r2=1726995&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/pack.c Wed Jan 27 11:12:36 2016
@@ -803,11 +803,11 @@ compare_ref_to_item(const reference_t *
 
 /* Look for the least significant bit set in VALUE and return the smallest
  * number with the same property, i.e. the largest power of 2 that is a
- * factor in VALUE. */
+ * factor in VALUE.  Edge case: roundness(0) := 0 . */
 static int
 roundness(int value)
 {
-  return value ? value - (value & (value - 1)) : INT_MAX;
+  return value - (value & (value - 1));
 }
 
 /* For all paths in first COUNT entries in PATH_ORDER, mark their latest