From 9317e4b89644635a9ce309c4626d917d886ae20b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 12:41:41 +0100 Subject: Merging upstream version 1.15~pre1. Signed-off-by: Daniel Baumann --- testsuite/check.sh | 166 ++++++++++++++++++++++++++++++++---------------- testsuite/fox5.lz | Bin 0 -> 400 bytes testsuite/fox5_bad.lz | Bin 400 -> 0 bytes testsuite/fox5_bad.txt | 4 -- testsuite/fox5_bad1.lz | Bin 0 -> 400 bytes testsuite/fox5_bad1.txt | 4 ++ testsuite/fox5_bad2.lz | Bin 0 -> 400 bytes testsuite/fox5_bad3.lz | Bin 0 -> 400 bytes testsuite/fox5_bad4.lz | Bin 0 -> 400 bytes testsuite/fox5_bad5.lz | Bin 0 -> 400 bytes testsuite/test.txt.lz | Bin 0 -> 11518 bytes testsuite/test_bad1.lz | Bin 11548 -> 11518 bytes testsuite/test_bad2.lz | Bin 11548 -> 11518 bytes testsuite/test_bad3.lz | Bin 11548 -> 11518 bytes testsuite/test_bad4.lz | Bin 11548 -> 11518 bytes testsuite/test_bad5.lz | Bin 11548 -> 11518 bytes testsuite/test_v0.lz | Bin 11540 -> 0 bytes testsuite/test_v1.lz | Bin 11548 -> 0 bytes testsuite/unzcrash.cc | 10 +-- 19 files changed, 119 insertions(+), 65 deletions(-) create mode 100644 testsuite/fox5.lz delete mode 100644 testsuite/fox5_bad.lz delete mode 100644 testsuite/fox5_bad.txt create mode 100644 testsuite/fox5_bad1.lz create mode 100644 testsuite/fox5_bad1.txt create mode 100644 testsuite/fox5_bad2.lz create mode 100644 testsuite/fox5_bad3.lz create mode 100644 testsuite/fox5_bad4.lz create mode 100644 testsuite/fox5_bad5.lz create mode 100644 testsuite/test.txt.lz delete mode 100644 testsuite/test_v0.lz delete mode 100644 testsuite/test_v1.lz (limited to 'testsuite') diff --git a/testsuite/check.sh b/testsuite/check.sh index ea6e768..4ac7f59 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -23,10 +23,15 @@ mkdir tmp cd "${objdir}"/tmp in="${testdir}"/test.txt -in_lz="${testdir}"/test_v1.lz +in_lz="${testdir}"/test.txt.lz inD="${testdir}"/test921-1921.txt -fox5="${testdir}"/fox5_bad.txt -fox5_lz="${testdir}"/fox5_bad.lz +fox5_lz="${testdir}"/fox5.lz +f5b1="${testdir}"/fox5_bad1.txt +f5b1_lz="${testdir}"/fox5_bad1.lz +f5b2_lz="${testdir}"/fox5_bad2.lz +f5b3_lz="${testdir}"/fox5_bad3.lz +f5b4_lz="${testdir}"/fox5_bad4.lz +f5b5_lz="${testdir}"/fox5_bad5.lz bad1_lz="${testdir}"/test_bad1.lz bad2_lz="${testdir}"/test_bad2.lz bad3_lz="${testdir}"/test_bad3.lz @@ -35,91 +40,140 @@ bad5_lz="${testdir}"/test_bad5.lz fail=0 # Description of test files for lziprecover: -# fox5_bad.lz: byte at offset 188 changed from 0x34 to 0x33 +# fox5_bad1.lz: byte at offset 62 changed from 0x50 to 0x70 (CRC) +# byte at offset 144 changed from 0x2D to 0x2E (data_size) +# byte at offset 188 changed from 0x34 to 0x33 (mid stream) +# byte at offset 247 changed from 0x2A to 0x2B (first byte) +# byte at offset 378 changed from 0xA0 to 0x20 (EOS marker) +# fox5_bad2.lz: [ 30- 49] --> zeroed; +# fox5_bad3.lz: [100-299] --> zeroed; +# fox5_bad4.lz: [250-349] --> zeroed; +# fox5_bad5.lz: [300-399] --> zeroed; # test_bad1.lz: byte at offset 67 changed from 0xCC to 0x33 -# test_bad2.lz: [ 34- 66) --> copy of bytes [ 68- 100) -# test_bad3.lz: [ 512-1536) --> zeroed; [2560-3584) --> zeroed -# test_bad4.lz: [3072-4096) --> random data; [4608-5632) --> zeroed -# test_bad5.lz: [1024-2048) --> random data; [5120-6144) --> random data +# test_bad2.lz: [ 34- 65] --> copy of bytes [ 68- 99] +# test_bad3.lz: [ 512-1535] --> zeroed; [2560-3583] --> zeroed +# test_bad4.lz: [3072-4095] --> random data; [4608-5631] --> zeroed +# test_bad5.lz: [1024-2047] --> random data; [5120-6143] --> random data printf "testing lziprecover-%s..." "$2" "${LZIPRECOVER}" -lq -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -mq "${bad1_lz}" -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -Rq -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -sq -if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi +if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi -"${LZIP}" -t "${testdir}"/test_v0.lz || fail=1 -printf . -"${LZIP}" -cd "${testdir}"/test_v0.lz > copy || fail=1 -cmp "${in}" copy || fail=1 -printf . - -"${LZIP}" -t "${testdir}"/test_v1.lz || fail=1 -printf . -"${LZIP}" -cd "${testdir}"/test_v1.lz > copy || fail=1 +"${LZIP}" -t "${testdir}"/test.txt.lz || fail=1 +"${LZIP}" -cd "${testdir}"/test.txt.lz > copy || fail=1 cmp "${in}" copy || fail=1 printf . "${LZIPRECOVER}" -D 921-1921 -fo copy "${in_lz}" || fail=1 cmp "${inD}" copy || fail=1 -printf . "${LZIPRECOVER}" -D 921,1000 "${in_lz}" > copy || fail=1 cmp "${inD}" copy || fail=1 printf . -"${LZIPRECOVER}" -D0 -iq -fo copy "${fox5_lz}" -if [ $? = 2 ] && cmp "${fox5}" copy ; then printf . ; else fail=1 ; printf - ; fi -"${LZIPRECOVER}" -D0 -iq "${fox5_lz}" > copy -if [ $? = 2 ] && cmp "${fox5}" copy ; then printf . ; else fail=1 ; printf - ; fi - +"${LZIPRECOVER}" -D0 -iq "${f5b1_lz}" -fo copy +if [ $? = 2 ] && cmp "${f5b1}" copy ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -D0 -iq "${f5b1_lz}" > copy +if [ $? = 2 ] && cmp "${f5b1}" copy ; then printf . ; else fail=1 ; printf - ; fi + +rm -f copy.lz +"${LZIPRECOVER}" -m -o copy.lz "${fox5_lz}" "${f5b1_lz}" +if [ $? = 0 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${f5b1_lz}" "${fox5_lz}" +if [ $? = 0 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" "${bad1_lz}" -q -if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi -"${LZIPRECOVER}" -m -o copy.lz "${bad1_lz}" "${bad2_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${f5b1_lz}" "${f5b5_lz}" -q +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${f5b3_lz}" "${f5b5_lz}" -q +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -m -o copy.lz "${bad3_lz}" "${bad4_lz}" -q +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi + +for i in "${f5b1_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" ; do + "${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${i}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${f5b2_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + printf . +done + +for i in "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" ; do + "${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${f5b2_lz}" "${i}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${i}" "${f5b2_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${f5b1_lz}" "${i}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${i}" "${f5b1_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${f5b1_lz}" "${f5b2_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${f5b2_lz}" "${f5b1_lz}" || fail=1 + cmp "${fox5_lz}" copy.lz || fail=1 + printf . +done + +"${LZIPRECOVER}" -mf -o copy.lz "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${f5b2_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${f5b1_lz}" "${f5b2_lz}" "${f5b3_lz}" "${f5b4_lz}" "${f5b5_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 printf . -"${LZIPRECOVER}" -m -o copy.lz "${bad2_lz}" "${bad1_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 + +"${LZIPRECOVER}" -mf -o copy.lz "${bad1_lz}" "${bad2_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad2_lz}" "${bad1_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . for i in "${bad1_lz}" "${bad2_lz}" ; do for j in "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" ; do - "${LZIPRECOVER}" -m -o copy.lz "${i}" "${j}" || fail=1 - "${LZIPRECOVER}" -df copy.lz || fail=1 - cmp "${in}" copy || fail=1 - printf . - "${LZIPRECOVER}" -m -o copy.lz "${j}" "${i}" || fail=1 - "${LZIPRECOVER}" -df copy.lz || fail=1 - cmp "${in}" copy || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${i}" "${j}" || fail=1 + cmp "${in_lz}" copy.lz || fail=1 + "${LZIPRECOVER}" -mf -o copy.lz "${j}" "${i}" || fail=1 + cmp "${in_lz}" copy.lz || fail=1 printf . done done -"${LZIPRECOVER}" -m -o copy.lz "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad3_lz}" "${bad4_lz}" "${bad5_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . -"${LZIPRECOVER}" -m -o copy.lz "${bad4_lz}" "${bad5_lz}" "${bad3_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad3_lz}" "${bad5_lz}" "${bad4_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . -"${LZIPRECOVER}" -m -o copy.lz "${bad5_lz}" "${bad3_lz}" "${bad4_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad4_lz}" "${bad3_lz}" "${bad5_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . - -"${LZIPRECOVER}" -R "${in_lz}" || fail=1 +"${LZIPRECOVER}" -mf -o copy.lz "${bad4_lz}" "${bad5_lz}" "${bad3_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 +printf . +"${LZIPRECOVER}" -mf -o copy.lz "${bad5_lz}" "${bad3_lz}" "${bad4_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 +printf . +"${LZIPRECOVER}" -mf -o copy.lz "${bad5_lz}" "${bad4_lz}" "${bad3_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . + +rm -f copy.lz +"${LZIPRECOVER}" -R -o copy.lz "${fox5_lz}" || fail=1 +if [ $? = 0 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi "${LZIPRECOVER}" -R -o copy.lz "${bad2_lz}" -q -if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi -"${LZIPRECOVER}" -R -o copy.lz "${bad1_lz}" || fail=1 -"${LZIPRECOVER}" -df copy.lz || fail=1 -cmp "${in}" copy || fail=1 +if [ $? = 2 ] && [ ! -e copy.lz ] ; then printf . ; else fail=1 ; printf - ; fi +"${LZIPRECOVER}" -Rf -o copy.lz "${f5b1_lz}" || fail=1 +cmp "${fox5_lz}" copy.lz || fail=1 +printf . +"${LZIPRECOVER}" -Rf -o copy.lz "${bad1_lz}" || fail=1 +cmp "${in_lz}" copy.lz || fail=1 printf . cat "${in_lz}" "${in_lz}" "${in_lz}" > copy || framework_failure diff --git a/testsuite/fox5.lz b/testsuite/fox5.lz new file mode 100644 index 0000000..3472f64 Binary files /dev/null and b/testsuite/fox5.lz differ diff --git a/testsuite/fox5_bad.lz b/testsuite/fox5_bad.lz deleted file mode 100644 index 8bfd314..0000000 Binary files a/testsuite/fox5_bad.lz and /dev/null differ diff --git a/testsuite/fox5_bad.txt b/testsuite/fox5_bad.txt deleted file mode 100644 index 813a71f..0000000 --- a/testsuite/fox5_bad.txt +++ /dev/null @@ -1,4 +0,0 @@ -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox c††zzzzzzzzzzzzzzzzzzzzzzThe quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. diff --git a/testsuite/fox5_bad1.lz b/testsuite/fox5_bad1.lz new file mode 100644 index 0000000..a3b5658 Binary files /dev/null and b/testsuite/fox5_bad1.lz differ diff --git a/testsuite/fox5_bad1.txt b/testsuite/fox5_bad1.txt new file mode 100644 index 0000000..14e5367 --- /dev/null +++ b/testsuite/fox5_bad1.txt @@ -0,0 +1,4 @@ +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox c††zzzzzzzzzzzzzzzzzzzzzzVhe quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. diff --git a/testsuite/fox5_bad2.lz b/testsuite/fox5_bad2.lz new file mode 100644 index 0000000..9993ea7 Binary files /dev/null and b/testsuite/fox5_bad2.lz differ diff --git a/testsuite/fox5_bad3.lz b/testsuite/fox5_bad3.lz new file mode 100644 index 0000000..ef58e47 Binary files /dev/null and b/testsuite/fox5_bad3.lz differ diff --git a/testsuite/fox5_bad4.lz b/testsuite/fox5_bad4.lz new file mode 100644 index 0000000..0474bb9 Binary files /dev/null and b/testsuite/fox5_bad4.lz differ diff --git a/testsuite/fox5_bad5.lz b/testsuite/fox5_bad5.lz new file mode 100644 index 0000000..6ec2740 Binary files /dev/null and b/testsuite/fox5_bad5.lz differ diff --git a/testsuite/test.txt.lz b/testsuite/test.txt.lz new file mode 100644 index 0000000..4db881a Binary files /dev/null and b/testsuite/test.txt.lz differ diff --git a/testsuite/test_bad1.lz b/testsuite/test_bad1.lz index 0b84883..687c8a1 100644 Binary files a/testsuite/test_bad1.lz and b/testsuite/test_bad1.lz differ diff --git a/testsuite/test_bad2.lz b/testsuite/test_bad2.lz index cce6a3c..c8ac08c 100644 Binary files a/testsuite/test_bad2.lz and b/testsuite/test_bad2.lz differ diff --git a/testsuite/test_bad3.lz b/testsuite/test_bad3.lz index a1676bb..3ed8936 100644 Binary files a/testsuite/test_bad3.lz and b/testsuite/test_bad3.lz differ diff --git a/testsuite/test_bad4.lz b/testsuite/test_bad4.lz index a8f89a3..c912871 100644 Binary files a/testsuite/test_bad4.lz and b/testsuite/test_bad4.lz differ diff --git a/testsuite/test_bad5.lz b/testsuite/test_bad5.lz index 73e0142..7c70365 100644 Binary files a/testsuite/test_bad5.lz and b/testsuite/test_bad5.lz differ diff --git a/testsuite/test_v0.lz b/testsuite/test_v0.lz deleted file mode 100644 index a09b1e8..0000000 Binary files a/testsuite/test_v0.lz and /dev/null differ diff --git a/testsuite/test_v1.lz b/testsuite/test_v1.lz deleted file mode 100644 index f1c79eb..0000000 Binary files a/testsuite/test_v1.lz and /dev/null differ diff --git a/testsuite/unzcrash.cc b/testsuite/unzcrash.cc index abf61bb..24defa6 100644 --- a/testsuite/unzcrash.cc +++ b/testsuite/unzcrash.cc @@ -58,11 +58,11 @@ void show_help() " -h, --help display this help and exit\n" " -V, --version output version information and exit\n" " -b, --bits= test N-bit errors instead of full byte\n" - " -p, --position= first byte position to test\n" + " -p, --position= first byte position to test [default 0]\n" " -q, --quiet suppress all messages\n" - " -s, --size= number of byte positions to test\n" + " -s, --size= number of byte positions to test [all]\n" " -v, --verbose be verbose (a 2nd -v gives more)\n" - "Examples of : 1 1,2,3 1-4 1,3-5,8\n" + "Examples of : 1 1,2,3 1-4 1,3-5,8 1-3,5-8\n" "\nReport bugs to lzip-bug@nongnu.org\n" "Lzip home page: http://www.nongnu.org/lzip/lzip.html\n" ); } @@ -109,8 +109,8 @@ unsigned long long getnum( const char * const ptr, const unsigned long long llimit, const unsigned long long ulimit ) { - errno = 0; char * tail; + errno = 0; unsigned long long result = strtoull( ptr, &tail, 0 ); if( tail == ptr ) { @@ -172,7 +172,7 @@ public: bool includes( const int i ) const { return ( i >= 1 && i <= 8 && data[i-1] ); } - // Recognized formats: 1 1,2,3 1-4 1,3-5,8 + // Recognized formats: 1 1,2,3 1-4 1,3-5,8 1-3,5-8 bool parse( const char * p ) { for( int i = 0; i < 8; ++i ) data[i] = false; -- cgit v1.2.3