]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: bit fuzzing should read the right bit when flipping
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 22 Aug 2017 15:01:30 +0000 (10:01 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 22 Aug 2017 15:01:30 +0000 (10:01 -0500)
The middle and last bit flip fuzz verbs need to read the same bit that
they're trying to set.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/fuzz.c

index 53cedbc69ecb32262f49efa02cb9a7be8e37f2a3..d0d78a9430c993d09fa44943a6a9d791ec27cbb9 100644 (file)
--- a/db/fuzz.c
+++ b/db/fuzz.c
@@ -226,7 +226,7 @@ fuzz_lastbit(
        int             nbits)
 {
        setbit_l((char *)buf, bitoff + nbits - 1,
-                       !getbit_l((char *)buf, bitoff));
+                       !getbit_l((char *)buf, bitoff + nbits - 1));
        return true;
 }
 
@@ -238,7 +238,7 @@ fuzz_middlebit(
        int             nbits)
 {
        setbit_l((char *)buf, bitoff + nbits / 2,
-                       !getbit_l((char *)buf, bitoff));
+                       !getbit_l((char *)buf, bitoff + nbits / 2));
        return true;
 }