diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 15:03:12 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 15:24:57 +0100 |
commit | 65ee81db857d3b44cec76aa94361abe5427430d8 (patch) | |
tree | 416af749ec08f122e616a265a653580795e1e4f3 | |
parent | 5140422e0d7319a8e2fe07f02cbcafc4d6538732 (diff) | |
download | gnutls-65ee81db857d3b44cec76aa94361abe5427430d8.tar.gz |
tests: added test case with invalid openpgp cert
This triggers an out of memory error. Issue found using oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=337
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/cert-tests/data/openpgp-invalid4.pub | 1 | ||||
-rwxr-xr-x | tests/cert-tests/openpgp-cert-parser | 43 |
2 files changed, 9 insertions, 35 deletions
diff --git a/tests/cert-tests/data/openpgp-invalid4.pub b/tests/cert-tests/data/openpgp-invalid4.pub new file mode 100644 index 0000000000..5bd7dea14b --- /dev/null +++ b/tests/cert-tests/data/openpgp-invalid4.pub @@ -0,0 +1 @@ +¶
\ No newline at end of file diff --git a/tests/cert-tests/openpgp-cert-parser b/tests/cert-tests/openpgp-cert-parser index 3d96848d45..d5c30f23fd 100755 --- a/tests/cert-tests/openpgp-cert-parser +++ b/tests/cert-tests/openpgp-cert-parser @@ -40,40 +40,13 @@ fail() { echo "Checking OpenPGP certificate parsing" -${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/truncated.pub" 2>&1 -rc=$? -if test $rc != 1;then - fail "Parsing should have errored" -fi - -${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/attribute-leak-1.pub" 2>&1 -rc=$? -if test $rc != 1;then - fail "Parsing should have errored" -fi - -${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/subpkt-leak.pub" 2>&1 -rc=$? -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 - -${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/openpgp-invalid2.pub" 2>&1 -rc=$? -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 +for i in "truncated.pub" "attribute-leak-1.pub" "subpkt-leak.pub" "openpgp-invalid1.pub" \ + "openpgp-invalid2.pub" "openpgp-invalid3.pub" "openpgp-invalid4.pub";do + ${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/${i}" + rc=$? + if test $rc != 1;then + fail "$i: Parsing should have errored ($rc)" + fi +done exit ${RETCODE:-0} |