summaryrefslogtreecommitdiff
path: root/tests/cert-tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-04 14:34:05 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-04 15:24:57 +0100
commitd949c6266ce64f5c2419f8c7cf4a196122fff9d7 (patch)
treeb663fb747d5291fa21491cf461b241302ee17d97 /tests/cert-tests
parent94a8d00a6bf96305543317de0ce4bb42da0327ab (diff)
downloadgnutls-d949c6266ce64f5c2419f8c7cf4a196122fff9d7.tar.gz
tests: added test case with invalid openpgp cert
This triggers a memory error. Issue found using oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=338 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/cert-tests')
-rw-r--r--tests/cert-tests/Makefile.am3
-rw-r--r--tests/cert-tests/data/openpgp-invalid1.pubbin0 -> 264 bytes
-rwxr-xr-xtests/cert-tests/openpgp-cert-parser6
3 files changed, 8 insertions, 1 deletions
diff --git a/tests/cert-tests/Makefile.am b/tests/cert-tests/Makefile.am
index 5e15f9eb3d..2c14da68fd 100644
--- a/tests/cert-tests/Makefile.am
+++ b/tests/cert-tests/Makefile.am
@@ -61,7 +61,8 @@ EXTRA_DIST = data/ca-no-pathlen.pem data/no-ca-or-pathlen.pem data/aki-cert.pem
data/selfsigs/alice.pub data/key-utf8-1.p12 data/key-utf8-2.p12 \
data/code-signing-ca.pem data/code-signing-cert.pem data/multi-value-dn.pem \
data/pkcs7-cat-ca.pem data/pkcs7-cat.p7 data/openssl.p7b data/openssl.p7b.out \
- data/openssl-keyid.p7b data/openssl-keyid.p7b.out data/openssl.p12
+ data/openssl-keyid.p7b data/openssl-keyid.p7b.out data/openssl.p12 \
+ data/openpgp-invalid1.pub
dist_check_SCRIPTS = pathlen aki certtool invalid-sig email \
pkcs7 pkcs7-broken-sigs privkey-import name-constraints certtool-long-cn crl provable-privkey \
diff --git a/tests/cert-tests/data/openpgp-invalid1.pub b/tests/cert-tests/data/openpgp-invalid1.pub
new file mode 100644
index 0000000000..dd38a04dc6
--- /dev/null
+++ b/tests/cert-tests/data/openpgp-invalid1.pub
Binary files differ
diff --git a/tests/cert-tests/openpgp-cert-parser b/tests/cert-tests/openpgp-cert-parser
index f30f1d6d83..eb3cb1ac98 100755
--- a/tests/cert-tests/openpgp-cert-parser
+++ b/tests/cert-tests/openpgp-cert-parser
@@ -58,4 +58,10 @@ if test $rc != 1;then
fail "Parsing should have errored"
fi
+${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/openpgp-invalid1.pub" 2>&1
+rc=$?
+if test $rc != 1;then
+ fail "Parsing should have errored"
+fi
+
exit ${RETCODE:-0}