summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-04-20 16:12:30 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-04-20 16:18:53 +0200
commit9e3ac5813e2e62de6fa2c8280edb05507a1a3e9f (patch)
treec2f837c485e07c72241e7a931501b7c1da4f9d9c
parent49924c02fed91580839b17686345406b232ea812 (diff)
downloadlibtasn1-9e3ac5813e2e62de6fa2c8280edb05507a1a3e9f.tar.gz
tests: Added test case based on Hanno Boeck's certificate
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/TestCertOctetOverflow.derbin0 -> 357 bytes
-rwxr-xr-xtests/decoding31
3 files changed, 34 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a00ebc7..0cd48a3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,13 +24,11 @@ LDADD = ../lib/libtasn1.la ../gl/libgnu.la
EXTRA_DIST = Test_parser.asn Test_tree.asn Test_tree_asn1_tab.c \
Test_encoding.asn pkix.asn TestIndef.p12 choice.asn coding-decoding2.asn \
- TestIndef2.p12 TestIndef3.der
+ TestIndef2.p12 TestIndef3.der TestCertOctetOverflow.der
# For crlf.
EXTRA_DIST += crlf.cer crl.der ocsp.der
-dist_check_SCRIPTS = crlf benchmark
-
-dist_check_SCRIPTS += threadsafety
+dist_check_SCRIPTS = crlf benchmark threadsafety decoding
MOSTLYCLEANFILES = Test_parser_ERROR.asn
@@ -41,7 +39,7 @@ check_PROGRAMS = Test_parser Test_tree Test_encoding Test_indefinite \
TESTS = Test_parser Test_tree Test_encoding Test_indefinite \
Test_errors Test_simple Test_overflow crlf threadsafety \
Test_strings Test_choice Test_encdec copynode coding-decoding2 \
- strict-der Test_choice_ocsp
+ strict-der Test_choice_ocsp decoding
TESTS_ENVIRONMENT = \
ASN1PARSER=$(srcdir)/Test_parser.asn \
diff --git a/tests/TestCertOctetOverflow.der b/tests/TestCertOctetOverflow.der
new file mode 100644
index 0000000..6c45107
--- /dev/null
+++ b/tests/TestCertOctetOverflow.der
Binary files differ
diff --git a/tests/decoding b/tests/decoding
new file mode 100755
index 0000000..ce230f4
--- /dev/null
+++ b/tests/decoding
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if ! test -z "${VALGRIND}";then
+VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=7 --leak-check=no"
+fi
+
+ASN1DECODING="${ASN1DECODING:-../src/asn1Decoding$EXEEXT}"
+ASN1PKIX="${ASN1PKIX:-pkix.asn}"
+
+$VALGRIND $ASN1DECODING -ds $ASN1PKIX TestCertOctetOverflow.der PKIX1.Certificate
+if test $? != 1;then
+ echo "Decoding failed"
+ exit 1
+fi
+
+exit 0