summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-05-18 18:20:13 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-05-18 18:28:12 +0200
commite43badf76307e1484fb257f271ff9a4f59258c7e (patch)
treec75f590127885294891b489d2a9fda65c3977c12
parent5520704d075802df25ce4ffccc010ba1641bd484 (diff)
downloadlibtasn1-e43badf76307e1484fb257f271ff9a4f59258c7e.tar.gz
tests: added reproducer for encoding issue
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/coding54
-rw-r--r--tests/invalid-assignments1.txt1
3 files changed, 58 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0b45543..b9cb886 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -46,12 +46,12 @@ EXTRA_DIST = Test_parser.asn Test_tree.asn Test_tree_asn1_tab.c mscat.asn \
invalid-x509/id-000032.der invalid-x509/id-000033.der \
invalid-x509/id-000034.der invalid-x509/id-000035.der \
invalid-pkcs7/id-000001.der invalid-pkcs7/id-000002.der \
- invalid-pkcs7/id-000003.der
+ invalid-pkcs7/id-000003.der invalid-assignments1.txt
# For crlf.
EXTRA_DIST += crlf.cer crl.der ocsp.der
dist_check_SCRIPTS = crlf benchmark threadsafety decoding decoding-invalid-x509 \
- decoding-invalid-pkcs7
+ decoding-invalid-pkcs7 coding
MOSTLYCLEANFILES = Test_parser_ERROR.asn
@@ -66,7 +66,7 @@ TESTS = Test_parser Test_tree Test_encoding Test_indefinite \
Test_strings Test_choice Test_encdec copynode coding-decoding2 \
strict-der Test_choice_ocsp decoding decoding-invalid-x509 \
ocsp-basic-response octet-string coding-long-oid object-id-decoding \
- spc_pe_image_data decoding-invalid-pkcs7
+ spc_pe_image_data decoding-invalid-pkcs7 coding
TESTS_ENVIRONMENT = \
ASN1PARSER=$(srcdir)/Test_parser.asn \
diff --git a/tests/coding b/tests/coding
new file mode 100755
index 0000000..b96b012
--- /dev/null
+++ b/tests/coding
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Copyright (C) 2017 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/>.
+
+srcdir="${srcdir:-.}"
+
+ASAN_OPTIONS="detect_leaks=0:exitcode=6"
+export ASAN_OPTIONS
+
+if ! test -z "${VALGRIND}";then
+VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=7 --leak-check=no"
+fi
+
+ASN1CODING="${ASN1CODING:-../src/asn1Coding$EXEEXT}"
+ASN1PKIX="${ASN1PKIX:-pkix.asn}"
+TMPFILE="asn1.$$.tmp"
+
+cat <<EOF >$TMPFILE
+PKIX1 { }
+
+DEFINITIONS IMPLICIT TAGS ::=
+
+BEGIN
+
+Dss-Sig-Value ::= SEQUENCE {
+ r INTEGER,
+ s INTEGER
+}
+
+END
+EOF
+
+$VALGRIND $ASN1CODING -c $TMPFILE ${srcdir}/invalid-assignments1.txt
+if test $? != 1;then
+ echo "Encoding failed"
+ exit 1
+fi
+
+rm -f $TMPFILE
+
+exit 0
diff --git a/tests/invalid-assignments1.txt b/tests/invalid-assignments1.txt
new file mode 100644
index 0000000..4b78266
--- /dev/null
+++ b/tests/invalid-assignments1.txt
@@ -0,0 +1 @@
+dp ?CIX1-V÷÷Kçrú÷÷÷alxeKIX1ãããi‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰‰g-VãþãããããKIX1.ããããããIsÿg-V÷÷Kçr÷÷÷÷-V \ No newline at end of file