From 0ef679720532fe97588c9d77f5a5f981b0150fe3 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Mon, 7 May 2018 15:46:28 +0800 Subject: [PATCH] btrfs-progs: tests: Add test case for dump-tree on heavily corrupted leaf Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- .../032-bad-item-ptr/bad_item_ptr.raw.xz | Bin 0 -> 21964 bytes tests/misc-tests/032-bad-item-ptr/test.sh | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz create mode 100755 tests/misc-tests/032-bad-item-ptr/test.sh diff --git a/tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz b/tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz new file mode 100644 index 0000000000000000000000000000000000000000..7cf2e89f443c626ad4947901bf659d5377278b3e GIT binary patch literal 21964 zcmeI4XH=7E7RN&uFc_pWNK3#VqJZ=+9i&K8Kok&EngK!)>C&q-qm+R_=!A|aMG)!T zK_Ljz1OkXuL7HH8_RP+i-JMx?m}MOHocC)!BsurJ_xJqo|Gm%M6ZbSW1%XIsaF11q zL0m*^AP@-h(zu&Ipd{tJ3IaLq5eS)232Jic3`j{!y{dTlOlAnh_R=(a!0WRuQZhsr z%6vN_BDBwDf`|NarlO#<1`{UCEp8E$ceb89@H=YPFy^XZZH75+>&wNg9$$NJ#zN%0 z;rZhpo5H6U1Gkgi59)zzK%S_bxc8=HAof@@kHOZbI58oz?9wI27f#x0NBiPv3yLgG)by5}WHvJi zd4E&ixcv=6GUN@99{O>Q><_rwF7Txf(6h6t~m6zYJVd2J1Vjvy}a32sruzkogbt(pFk>3 zOkN!tbI+r4vX$ZPo{Cx|h)TFz%S@n4ER{?NpAop0@+JONd#ojU@OReDuz@L&_|i?R zPxDwFfiRr!Mvr8b_DY+X!?#g6u&B!qISok&hw&Y=(Helq!pIjqoh#H$3|o=4sFa6~ z6KaeF%0!;tXt4G)5OqpU2k%x!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~3d@7{D-qVF1Iv-C)jF#^}DyOb`Hl0Qvy*4;l1NgBD!tHbk!(M10H3>xaXD*w503 z;iAtvMOwRR2)B>-rh?=x`ZCfR_qFsHv`4| zpi{yNf8fj^8v}cH;M+sKYN9ofDH4Dj`vW-!Y{B?1>q34eE^wXwckWjK0tVd925x8n zdhgKBbpf=K`veIPFd$&RUMBZdIS2#{2-yF;t`NwuzmU9t;ZFlff1mjLd%*m~yFnD7 z1*G3YtD#+h%&H5{{H?7KYnJ1?474)k{0}NmEeyXTun^>2EI5V ABLDyZ literal 0 HcmV?d00001 diff --git a/tests/misc-tests/032-bad-item-ptr/test.sh b/tests/misc-tests/032-bad-item-ptr/test.sh new file mode 100755 index 00000000..cfbfe1a5 --- /dev/null +++ b/tests/misc-tests/032-bad-item-ptr/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Verify that btrfs inspect dump-tree won't segfault on heavily corrupted +# tree leaf +# Issue: #128 + +source "$TEST_TOP/common" + +check_prereq btrfs + +check_image() { + run_check "$TOP/btrfs" inspect-internal dump-tree "$1" + run_mustfail "btrfs check failed to detect such corruption" \ + "$TOP/btrfs" check "$1" +} + +check_all_images