summaryrefslogtreecommitdiff
path: root/regress/lib/libcrypto
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-05-03 17:00:46 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-05-03 17:00:46 +0000
commit507fc9884795a195b8afae8e1d1d1b4b69c79c16 (patch)
treea36274271f1bb16ee6523063968f24bdb73a9be7 /regress/lib/libcrypto
parentd78f968d699c9357b07d4421dba18c8ace2f8b4d (diff)
Update the base64 regress test and enable a test that would previously
have resulted in a segfault. Also update the resulting output bytes now that the invalid/corrupt input is detected and rejected; unless you're using BIO_FLAGS_BASE64_NO_NL, in which case you still get a stream of zero value bytes and no way of knowing that the data is invalid/corrupt.
Diffstat (limited to 'regress/lib/libcrypto')
-rw-r--r--regress/lib/libcrypto/base64/base64test.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/regress/lib/libcrypto/base64/base64test.c b/regress/lib/libcrypto/base64/base64test.c
index 2db10f6007c..a7d167e97d1 100644
--- a/regress/lib/libcrypto/base64/base64test.c
+++ b/regress/lib/libcrypto/base64/base64test.c
@@ -67,17 +67,6 @@ struct base64_test base64_tests[] = {
48,
34,
},
-
-#ifdef crash
- {
- "",
- -1,
- "YWJjZA======================================================"
- "============",
- 74,
- 0,
- },
-#endif
};
#define N_TESTS (sizeof(base64_tests) / sizeof(*base64_tests))
@@ -86,14 +75,14 @@ struct base64_test base64_nl_tests[] = {
/* Corrupt/invalid encodings. */
{ "", -1, "", 0, 0, },
- { "", -1, "!!!!", 4, 0, }, /* 20 */
- { "", -1, "====", 4, 1, }, /* XXX - output ix 0x0. */
- { "", -1, "x===", 4, 1, },
- { "", -1, "=AAA", 4, 3, },
- { "", -1, "A=AA", 4, 3, },
- { "", -1, "AA=A", 4, 2, },
+ { "", -1, "!!!!", 4, 0, },
+ { "", -1, "====", 4, 0, },
+ { "", -1, "x===", 4, 0, },
+ { "", -1, "=AAA", 4, 0, },
+ { "", -1, "A=AA", 4, 0, },
+ { "", -1, "AA=A", 4, 0, },
{ "", -1, "AA==A", 5, 0, },
- { "", -1, "AAA=AAAA", 8, 6, },
+ { "", -1, "AAA=AAAA", 8, 0, },
{ "", -1, "AAAAA", 5, 0, },
{ "", -1, "AAAAAA", 6, 0, },
{ "", -1, "A=", 2, 0, },
@@ -119,6 +108,14 @@ struct base64_test base64_nl_tests[] = {
{ "sure", 4, "c3VyZQ=\n=", 9, 4, },
{ "sure", 4, "c3VyZQ=\r\n\r\n=", 12, 4, },
+ {
+ "",
+ -1,
+ "YWJjZA======================================================"
+ "============",
+ 74,
+ 0,
+ },
};
#define N_NL_TESTS (sizeof(base64_nl_tests) / sizeof(*base64_nl_tests))
@@ -133,7 +130,7 @@ struct base64_test base64_no_nl_tests[] = {
/* Corrupt/invalid encodings. */
{ "", -1, "", 0, 0, },
- { "", -1, "!!!!", 4, 0, }, /* 20 */
+ { "", -1, "!!!!", 4, 0, },
{ "", -1, "====", 4, 1, },
{ "", -1, "x===", 4, 1, },
{ "", -1, "=AAA", 4, 3, },
@@ -165,6 +162,18 @@ struct base64_test base64_no_nl_tests[] = {
{ "sure", -1, "c3VyZQ=\n=", 9, 0, },
{ "sure", -1, "c3VyZQ=\r\n\r\n=", 12, 0, },
+ /*
+ * This is invalid, yet results in 'abcd' followed by a stream of
+ * zero value bytes.
+ */
+ {
+ "",
+ -1,
+ "YWJjZA======================================================"
+ "============",
+ 74,
+ 52,
+ },
};
#define N_NO_NL_TESTS (sizeof(base64_no_nl_tests) / sizeof(*base64_no_nl_tests))