From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Buchbinder Subject: [PATCH v2 2/2] tests: dumpe2fs against an image with bad os_type. Date: Tue, 18 Jul 2017 14:48:23 -0700 Message-ID: <20170718214823.22649-3-abuchbinder@google.com> References: <20170718192919.32406-1-abuchbinder@google.com> <20170718214823.22649-1-abuchbinder@google.com> Cc: Adam Buchbinder To: linux-ext4@vger.kernel.org Return-path: Received: from mail-pf0-f176.google.com ([209.85.192.176]:32916 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753180AbdGRVsh (ORCPT ); Tue, 18 Jul 2017 17:48:37 -0400 Received: by mail-pf0-f176.google.com with SMTP id s70so8290138pfs.0 for ; Tue, 18 Jul 2017 14:48:36 -0700 (PDT) In-Reply-To: <20170718214823.22649-1-abuchbinder@google.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: 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 --- tests/d_bad_ostype/expect | 1 + tests/d_bad_ostype/name | 1 + tests/d_bad_ostype/script | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/d_bad_ostype/expect create mode 100644 tests/d_bad_ostype/name create mode 100644 tests/d_bad_ostype/script diff --git a/tests/d_bad_ostype/expect b/tests/d_bad_ostype/expect new file mode 100644 index 00000000..b00318c4 --- /dev/null +++ b/tests/d_bad_ostype/expect @@ -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 index 00000000..3da887a8 --- /dev/null +++ b/tests/d_bad_ostype/name @@ -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 index 00000000..992a3030 --- /dev/null +++ b/tests/d_bad_ostype/script @@ -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 -- 2.14.0.rc0.284.gd933b75aa4-goog