From 326e59468a789d4cf72421e91d9df417abc56055 Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Tue, 19 Nov 2024 11:02:40 -0500 Subject: [PATCH] Test cleanup --- crypto/asn1/asn1_test.cc | 2 +- crypto/pkcs7/pkcs7.c | 3 +-- crypto/pkcs7/pkcs7_test.cc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crypto/asn1/asn1_test.cc b/crypto/asn1/asn1_test.cc index 91ba691e33..f150d2d2b2 100644 --- a/crypto/asn1/asn1_test.cc +++ b/crypto/asn1/asn1_test.cc @@ -2315,7 +2315,7 @@ const struct GetObjectTestData { {{0x61, 0x80, 0xC2, 0x02, 0xAB, 0xCD, 0x00, 0x00}, 0x21, 0x01, 0x40, 0}, }; -static void verifyGetObject(GetObjectTestData t) { +static void verifyGetObject(GetObjectTestData& t) { long length; int tag; int tag_class; diff --git a/crypto/pkcs7/pkcs7.c b/crypto/pkcs7/pkcs7.c index 3e2a097699..984b6b56e9 100644 --- a/crypto/pkcs7/pkcs7.c +++ b/crypto/pkcs7/pkcs7.c @@ -644,7 +644,6 @@ static int pkcs7_bio_add_digest(BIO **pbio, X509_ALGOR *alg) { OPENSSL_PUT_ERROR(PKCS7, ERR_R_BIO_LIB); goto err; } - btmp = NULL; return 1; @@ -1014,7 +1013,7 @@ OPENSSL_END_ALLOW_DEPRECATED if (si_sk != NULL) { for (size_t ii = 0; ii < sk_PKCS7_SIGNER_INFO_num(si_sk); ii++) { si = sk_PKCS7_SIGNER_INFO_value(si_sk, ii); - if (si->pkey == NULL) { + if (si == NULL || si->pkey == NULL) { continue; } int sign_nid = OBJ_obj2nid(si->digest_alg->algorithm); diff --git a/crypto/pkcs7/pkcs7_test.cc b/crypto/pkcs7/pkcs7_test.cc index a8199edc1b..4dfe85efa3 100644 --- a/crypto/pkcs7/pkcs7_test.cc +++ b/crypto/pkcs7/pkcs7_test.cc @@ -1673,7 +1673,7 @@ TEST(PKCS7Test, DataInitFinal) { bio_in.reset(BIO_new(BIO_s_mem())); ASSERT_TRUE(p7); ASSERT_TRUE(PKCS7_set_type(p7.get(), NID_pkcs7_encrypted)); - bio.reset(PKCS7_dataInit(p7.get(), bio_in.get())); + bio.reset(PKCS7_dataInit(p7.get(), bio_in.release())); EXPECT_FALSE(bio); EXPECT_FALSE(PKCS7_dataFinal(p7.get(), bio.get()));