]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix potential infinite loop in e2fsck on really big filesystems
authorTheodore Ts'o <tytso@mit.edu>
Mon, 2 Apr 2007 23:27:44 +0000 (19:27 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 2 Apr 2007 23:27:44 +0000 (19:27 -0400)
Prevent floating point precision errors on really big filesystems from
causing the search interpolation algorithm in the icount abstraction
from looping forever.

Addresses Debian Bug: #411838

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ChangeLog
lib/ext2fs/icount.c

index 7d55e9d90fef3bbbbe89f9df7c0d5b6029cb4a45..b5c9add61da0cd6469df08fada74343b739807cc 100644 (file)
@@ -1,3 +1,10 @@
+2007-04-02  Theodore Tso  <tytso@mit.edu>
+
+       * icount.c (get_icount_el): Prevent floating point precision
+               errors on really big filesystems from causing the search
+               interpolation algorithm loop forever.  (Addresses Debian
+               Bug: #411838)
+
 2007-03-21  Theodore Tso  <tytso@mit.edu>
 
        * imager.c (ext2fs_image_inode_write), inode.c
index c8cdc2518e875205c10604efddc53d46e7098db9..efc74c0971d74071513010d3f63d260466ded833 100644 (file)
@@ -247,9 +247,14 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
                                range = 0;
                        else if (ino > highval)
                                range = 1;
-                       else 
+                       else {
                                range = ((float) (ino - lowval)) /
                                        (highval - lowval);
+                               if (range > 0.9)
+                                       range = 0.9;
+                               if (range < 0.1)
+                                       range = 0.1;
+                       }
                        mid = low + ((int) (range * (high-low)));
                }
 #endif