aboutsummaryrefslogtreecommitdiff
path: root/testsuite/bunzip2.tests
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-08 20:02:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-08 20:05:04 +0200
commit38ccd6af8abbafff98d458a1c62909acfc09a514 (patch)
tree1a4158db5c7e5e98111ff99d4a9078d93b4ccfcc /testsuite/bunzip2.tests
parent8e2174e9bd836e53c8b9c6e00d1bc6e2a718686e (diff)
downloadbusybox-w32-38ccd6af8abbafff98d458a1c62909acfc09a514.tar.gz
busybox-w32-38ccd6af8abbafff98d458a1c62909acfc09a514.tar.bz2
busybox-w32-38ccd6af8abbafff98d458a1c62909acfc09a514.zip
bzip2: fix two crashes on corrupted archives
As it turns out, longjmp'ing into freed stack is not healthy... function old new delta unpack_usage_messages - 97 +97 unpack_bz2_stream 369 409 +40 get_next_block 1667 1677 +10 get_bits 156 155 -1 start_bunzip 212 183 -29 bb_show_usage 181 120 -61 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/3 up/down: 147/-91) Total: 56 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/bunzip2.tests')
-rwxr-xr-xtestsuite/bunzip2.tests16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/bunzip2.tests b/testsuite/bunzip2.tests
index fcfce1a31..edb332748 100755
--- a/testsuite/bunzip2.tests
+++ b/testsuite/bunzip2.tests
@@ -552,6 +552,22 @@ if test "${0##*/}" = "bunzip2.tests"; then
552 echo "FAIL: $unpack: pbzip_4m_zeros file" 552 echo "FAIL: $unpack: pbzip_4m_zeros file"
553 FAILCOUNT=$((FAILCOUNT + 1)) 553 FAILCOUNT=$((FAILCOUNT + 1))
554 fi 554 fi
555
556 errout="`${bb}bunzip2 <bz2_issue_11.bz2 2>&1 >/dev/null`"
557 if test x"$errout:$?" = x"bunzip2: bunzip error -5:1"; then
558 echo "PASS: $unpack: bz2_issue_11.bz2 corrupted example"
559 else
560 echo "FAIL: $unpack: bz2_issue_11.bz2 corrupted example"
561 FAILCOUNT=$((FAILCOUNT + 1))
562 fi
563
564 errout="`${bb}bunzip2 <bz2_issue_12.bz2 2>&1 >/dev/null`"
565 if test x"$errout:$?" = x"bunzip2: bunzip error -3:1"; then
566 echo "PASS: $unpack: bz2_issue_12.bz2 corrupted example"
567 else
568 echo "FAIL: $unpack: bz2_issue_12.bz2 corrupted example"
569 FAILCOUNT=$((FAILCOUNT + 1))
570 fi
555fi 571fi
556 572
557exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255)) 573exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))