lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 30 Jun 2010 01:15:23 -0400 (EDT)
From:	Lachlan McIlroy <lmcilroy@...hat.com>
To:	Lachlan McIlroy <lmcilroy@...hat.com>
Cc:	ext4 development <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH V2] e2fsck: fix floating point precision error

Fix floating point precision error in e2fsck.

Commit 641b66bc7ee0a880b0eb0125dff5f8ed8dd5a160 fixed a floating
point precision error which can result in a search algorithm looping
forever.  It can also result in an array index being out of bounds
and causing a segfault.  Here are two more cases that need to be
fixed.  I've just used the same fix from the that commit.

Version 2: this time it's a patch against latest git, sorry for that.

Signed-off-by: Lachlan McIlroy <lmcilroy@...hat.com>


diff --git a/e2fsck/ea_refcount.c b/e2fsck/ea_refcount.c
index 39f2db7..b10cfff 100644
--- a/e2fsck/ea_refcount.c
+++ b/e2fsck/ea_refcount.c
@@ -196,9 +196,14 @@ retry:
 				range = 0;
 			else if (blk > highval)
 				range = 1;
-			else
+			else {
 				range = ((float) (blk - lowval)) /
 					(highval - lowval);
+				if (range > 0.9)
+					range = 0.9;
+				if (range < 0.1)
+					range = 0.1;
+			}
 			mid = low + ((int) (range * (high-low)));
 		}
 #endif
diff --git a/resize/extent.c b/resize/extent.c
index 0da8df6..94eb689 100644
--- a/resize/extent.c
+++ b/resize/extent.c
@@ -167,9 +167,14 @@ __u64 ext2fs_extent_translate(ext2_extent extent, __u64 old_loc)
 				range = 0;
 			else if (old_loc > highval)
 				range = 1;
-			else
+			else {
 				range = ((float) (old_loc - lowval)) /
 					(highval - lowval);
+				if (range > 0.9)
+					range = 0.9;
+				if (range < 0.1)
+					range = 0.1;
+			}
 			mid = low + ((__u64) (range * (high-low)));
 		}
 #endif

----- "Lachlan McIlroy" <lmcilroy@...hat.com> wrote:

> Fix floating point precision error in e2fsck.
> 
> Commit 641b66bc7ee0a880b0eb0125dff5f8ed8dd5a160 fixed a floating
> point precision error which can result in a search algorithm looping
> forever.  It can also result in an array index being out of bounds
> and causing a segfault.  Here are two more cases that need to be
> fixed.  I've just used the same fix from the that commit.
> 
> diff -up e2fsprogs-1.39/e2fsck/ea_refcount.c.orig
> e2fsprogs-1.39/e2fsck/ea_refcount.c
> --- e2fsprogs-1.39/e2fsck/ea_refcount.c.orig	2010-06-30
> 11:14:51.516239079 +1000
> +++ e2fsprogs-1.39/e2fsck/ea_refcount.c	2010-06-30 11:22:22.277362222
> +1000
> @@ -193,9 +193,14 @@ retry:
>  				range = 0;
>  			else if (blk > highval)
>  				range = 1;
> -			else 
> +			else {
>  				range = ((float) (blk - lowval)) /
>  					(highval - lowval);
> +				if (range > 0.9)
> +					range = 0.9;
> +				if (range < 0.1)
> +					range = 0.1;
> +			}
>  			mid = low + ((int) (range * (high-low)));
>  		}
>  #endif
> diff -up e2fsprogs-1.39/resize/extent.c.orig
> e2fsprogs-1.39/resize/extent.c
> --- e2fsprogs-1.39/resize/extent.c.orig	2010-06-30 11:25:58.969188333
> +1000
> +++ e2fsprogs-1.39/resize/extent.c	2010-06-30 11:26:40.449327216
> +1000
> @@ -167,9 +167,14 @@ __u32 ext2fs_extent_translate(ext2_exten
>  				range = 0;
>  			else if (old_loc > highval)
>  				range = 1;
> -			else 
> +			else {
>  				range = ((float) (old_loc - lowval)) /
>  					(highval - lowval);
> +				if (range > 0.9)
> +					range = 0.9;
> +				if (range < 0.1)
> +					range = 0.1;
> +			}
>  			mid = low + ((int) (range * (high-low)));
>  		}
>  #endif
> 
> Lachlan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4"
> in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ