Whamcloud - gitweb
tests: dumpe2fs against an image with bad os_type
authorAdam Buchbinder <abuchbinder@google.com>
Sat, 22 Jul 2017 21:52:53 +0000 (17:52 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 22 Jul 2017 21:52:56 +0000 (17:52 -0400)
The os_type here is large enough to be negative when interpreted as a
signed integer.

This test case was generated by american fuzzy lop, starting from a
base filesystem image from files.fuzzing-project.org.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/d_bad_ostype/expect [new file with mode: 0644]
tests/d_bad_ostype/name [new file with mode: 0644]
tests/d_bad_ostype/script [new file with mode: 0644]

diff --git a/tests/d_bad_ostype/expect b/tests/d_bad_ostype/expect
new file mode 100644 (file)
index 0000000..b00318c
--- /dev/null
@@ -0,0 +1 @@
+Filesystem OS type:       (unknown os)
diff --git a/tests/d_bad_ostype/name b/tests/d_bad_ostype/name
new file mode 100644 (file)
index 0000000..3da887a
--- /dev/null
@@ -0,0 +1 @@
+handle bad (negative) os_type
diff --git a/tests/d_bad_ostype/script b/tests/d_bad_ostype/script
new file mode 100644 (file)
index 0000000..992a303
--- /dev/null
@@ -0,0 +1,21 @@
+dd if=/dev/zero of=$TMPFILE bs=1k count=64 > /dev/null 2>&1
+$MKE2FS -q -b 1024 $TMPFILE
+$DEBUGFS -w -R 'set_super_value creator_os 0xf0000000' $TMPFILE
+
+OUT=$test_name.log
+EXP=$test_dir/expect
+$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed | grep 'Filesystem OS type:' > $OUT
+
+rm -f $TMPFILE
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+        echo "$test_name: $test_description: ok"
+        touch $test_name.ok
+else
+        echo "$test_name: $test_description: failed"
+        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+        rm -f $test_name.tmp
+fi
+unset OUT EXP