diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 14:48:38 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 15:24:57 +0100 |
commit | 611098e2f01fd8c3a5a625d61f26c56fcb3d770c (patch) | |
tree | aff60536fdbf9c7f26fc1a39ecf361e3ba9e040b | |
parent | e08b66b7cb4bc3f7ad56d081f0357ec1d39aa4ec (diff) | |
download | gnutls-611098e2f01fd8c3a5a625d61f26c56fcb3d770c.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=340
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/cert-tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/cert-tests/data/openpgp-invalid3.pub | bin | 0 -> 124 bytes | |||
-rwxr-xr-x | tests/cert-tests/openpgp-cert-parser | 6 |
3 files changed, 7 insertions, 1 deletions
diff --git a/tests/cert-tests/Makefile.am b/tests/cert-tests/Makefile.am index 51a4e5c63d..4ea9af9806 100644 --- a/tests/cert-tests/Makefile.am +++ b/tests/cert-tests/Makefile.am @@ -62,7 +62,7 @@ EXTRA_DIST = data/ca-no-pathlen.pem data/no-ca-or-pathlen.pem data/aki-cert.pem 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/openpgp-invalid1.pub data/openpgp-invalid2.pub + data/openpgp-invalid1.pub data/openpgp-invalid2.pub data/openpgp-invalid3.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-invalid3.pub b/tests/cert-tests/data/openpgp-invalid3.pub Binary files differnew file mode 100644 index 0000000000..65d1b59045 --- /dev/null +++ b/tests/cert-tests/data/openpgp-invalid3.pub diff --git a/tests/cert-tests/openpgp-cert-parser b/tests/cert-tests/openpgp-cert-parser index c38789441c..3d96848d45 100755 --- a/tests/cert-tests/openpgp-cert-parser +++ b/tests/cert-tests/openpgp-cert-parser @@ -70,4 +70,10 @@ if test $rc != 1;then fail "Parsing should have errored" fi +${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/openpgp-invalid3.pub" 2>&1 +rc=$? +if test $rc != 1;then + fail "Parsing should have errored" +fi + exit ${RETCODE:-0} |