summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrob <rob@cvs.openbsd.org>2019-05-10 13:28:41 +0000
committerrob <rob@cvs.openbsd.org>2019-05-10 13:28:41 +0000
commitf16e61e66b2b5ec79eca82af98886596c97a38bb (patch)
treea6f158329ef5c750ab825a8008ee8d384d9fc646
parentf3e577069aa9579c1d45f7d22a0ef9b1165eb5c7 (diff)
Add some more edge case tests.
-rw-r--r--regress/lib/libutil/ber/ber_test.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/regress/lib/libutil/ber/ber_test.c b/regress/lib/libutil/ber/ber_test.c
index f8e5e85cc14..e91833a6c81 100644
--- a/regress/lib/libutil/ber/ber_test.c
+++ b/regress/lib/libutil/ber/ber_test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber_test.c,v 1.10 2019/03/31 01:00:32 rob Exp $
+/* $OpenBSD: ber_test.c,v 1.11 2019/05/10 13:28:40 rob Exp $
*/
/*
* Copyright (c) Rob Pierce <rob@openbsd.org>
@@ -45,6 +45,24 @@ struct test_vector test_vectors[] = {
},
},
{
+ FAIL,
+ 0,
+ "boolean (constructed - expected failure)",
+ 3,
+ {
+ 0x21, 0x01, 0xff
+ },
+ },
+ {
+ FAIL,
+ 0,
+ "boolean (more than 1 content octet - expected failure)",
+ 4,
+ {
+ 0x01, 0x02, 0x00, 0xff
+ },
+ },
+ {
SUCCEED,
1,
"integer (zero)",
@@ -181,21 +199,21 @@ struct test_vector test_vectors[] = {
}
},
{
- SUCCEED,
+ FAIL,
0,
- "maximum long form tagging (i.e. 4 byte tag id)",
- 7,
+ "reserved for future use (expected failure)",
+ 4,
{
- 0x1f, 0x80, 0x80, 0x80, 0x02, 0x01, 0x01
- },
+ 0x30, 0xff, 0x01, 0x01
+ }
},
{
FAIL,
0,
- "overflow long form tagging (expected failure)",
- 8,
+ "long form tagging prohibited (expected failure)",
+ 5,
{
- 0x1f, 0x80, 0x80, 0x80, 0x80, 0x02, 0x01, 0x01
+ 0x1f, 0x80, 0x02, 0x01, 0x01
},
},
{