summaryrefslogtreecommitdiffstats
path: root/test/integration/test-github-111-invalid-armember
blob: e4b897ec3f64cca09401d8ecb8f624d627f411bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture "amd64"
setupaptarchive

# this used to crash, but it should treat it as an invalid member header
touch ' '
ar -q test.deb ' '
testsuccessequal "E: Invalid archive member header" ${APTTESTHELPERSBINDIR}/testdeb test.deb


rm test.deb
touch 'x'
ar -q test.deb 'x'
testsuccessequal "E: This is not a valid DEB archive, missing 'debian-binary' member" ${APTTESTHELPERSBINDIR}/testdeb test.deb


# <name><size> [ other fields] - name is not nul terminated here, it ends in .
msgmsg "Unterminated ar member name"
printf '!<arch>\0120123456789ABCDE.A123456789A.01234.01234.0123456.012345678.0.' > test.deb
testsuccessequal "E: Invalid archive member header" ${APTTESTHELPERSBINDIR}/testdeb test.deb


${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 github-111 control.tar
gzip control.tar
cp control.tar.gz data.tar.gz
touch debian-binary
rm test.deb
ar -q test.deb debian-binary control.tar.gz data.tar.gz
testsuccessequal "W: Unknown TAR header type 88" ${APTTESTHELPERSBINDIR}/testdeb test.deb