Add test for d2i_PKCS7 NULL dereference
authorTomas Mraz <tomas@openssl.org>
Mon, 16 Jan 2023 18:56:20 +0000 (19:56 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 7 Feb 2023 16:02:47 +0000 (17:02 +0100)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
test/recipes/25-test_pkcs7.t
test/recipes/25-test_pkcs7_data/malformed.pkcs7 [new file with mode: 0644]

index 37cd43dc6bf8cd3a140f314e83697246d4b71063..d61cd6abadcd2355d790b352cf310ac038cd1c3c 100644 (file)
@@ -11,11 +11,11 @@ use strict;
 use warnings;
 
 use File::Spec;
-use OpenSSL::Test qw/:DEFAULT srctop_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file data_file/;
 
 setup("test_pkcs7");
 
-plan tests => 3;
+plan tests => 4;
 
 require_ok(srctop_file('test','recipes','tconversion.pl'));
 
@@ -27,3 +27,6 @@ subtest 'pkcs7 conversions -- pkcs7d' => sub {
     tconversion( -type => 'p7d', -in => srctop_file("test", "pkcs7-1.pem"),
                  -args => ["pkcs7"] );
 };
+
+my $malformed = data_file('malformed.pkcs7');
+ok(run(app(["openssl", "pkcs7", "-in", $malformed])));
diff --git a/test/recipes/25-test_pkcs7_data/malformed.pkcs7 b/test/recipes/25-test_pkcs7_data/malformed.pkcs7
new file mode 100644 (file)
index 0000000..e30d1b5
--- /dev/null
@@ -0,0 +1,3 @@
+-----BEGIN PKCS7-----
+MAsGCSqGSIb3DQEHAg==
+-----END PKCS7-----