test/evp_extra_test.c:744: error: NULL_DEREFERENCE
  pointer `pkey` last assigned on line 704 could be null and is dereferenced by call to `EVP_PKEY_CTX_new()` at line 744, column 10.
Showing all 25 steps of the trace


test/evp_extra_test.c:700:1: start of procedure test_EVP_PKEY_check()
698.   static EVP_PKEY_METHOD *custom_pmeth;
699.   
700. > static int test_EVP_PKEY_check(int i)
701.   {
702.       int ret = 0;

test/evp_extra_test.c:702:5: 
700.   static int test_EVP_PKEY_check(int i)
701.   {
702. >     int ret = 0;
703.       const unsigned char *p;
704.       EVP_PKEY *pkey = NULL;

test/evp_extra_test.c:704:5: 
702.       int ret = 0;
703.       const unsigned char *p;
704. >     EVP_PKEY *pkey = NULL;
705.   #ifndef OPENSSL_NO_EC
706.       EC_KEY *eckey = NULL;

test/evp_extra_test.c:706:5: 
704.       EVP_PKEY *pkey = NULL;
705.   #ifndef OPENSSL_NO_EC
706. >     EC_KEY *eckey = NULL;
707.   #endif
708.       EVP_PKEY_CTX *ctx = NULL;

test/evp_extra_test.c:708:5: 
706.       EC_KEY *eckey = NULL;
707.   #endif
708. >     EVP_PKEY_CTX *ctx = NULL;
709.       EVP_PKEY_CTX *ctx2 = NULL;
710.       const APK_DATA *ak = &keycheckdata[i];

test/evp_extra_test.c:709:5: 
707.   #endif
708.       EVP_PKEY_CTX *ctx = NULL;
709. >     EVP_PKEY_CTX *ctx2 = NULL;
710.       const APK_DATA *ak = &keycheckdata[i];
711.       const unsigned char *input = ak->kder;

test/evp_extra_test.c:710:5: 
708.       EVP_PKEY_CTX *ctx = NULL;
709.       EVP_PKEY_CTX *ctx2 = NULL;
710. >     const APK_DATA *ak = &keycheckdata[i];
711.       const unsigned char *input = ak->kder;
712.       size_t input_len = ak->size;

test/evp_extra_test.c:711:5: 
709.       EVP_PKEY_CTX *ctx2 = NULL;
710.       const APK_DATA *ak = &keycheckdata[i];
711. >     const unsigned char *input = ak->kder;
712.       size_t input_len = ak->size;
713.       int expected_id = ak->evptype;

test/evp_extra_test.c:712:5: 
710.       const APK_DATA *ak = &keycheckdata[i];
711.       const unsigned char *input = ak->kder;
712. >     size_t input_len = ak->size;
713.       int expected_id = ak->evptype;
714.       int expected_check = ak->check;

test/evp_extra_test.c:713:5: 
711.       const unsigned char *input = ak->kder;
712.       size_t input_len = ak->size;
713. >     int expected_id = ak->evptype;
714.       int expected_check = ak->check;
715.       int expected_pub_check = ak->pub_check;

test/evp_extra_test.c:714:5: 
712.       size_t input_len = ak->size;
713.       int expected_id = ak->evptype;
714. >     int expected_check = ak->check;
715.       int expected_pub_check = ak->pub_check;
716.       int expected_param_check = ak->param_check;

test/evp_extra_test.c:715:5: 
713.       int expected_id = ak->evptype;
714.       int expected_check = ak->check;
715. >     int expected_pub_check = ak->pub_check;
716.       int expected_param_check = ak->param_check;
717.       int type = ak->type;

test/evp_extra_test.c:716:5: 
714.       int expected_check = ak->check;
715.       int expected_pub_check = ak->pub_check;
716. >     int expected_param_check = ak->param_check;
717.       int type = ak->type;
718.       BIO *pubkey = NULL;

test/evp_extra_test.c:717:5: 
715.       int expected_pub_check = ak->pub_check;
716.       int expected_param_check = ak->param_check;
717. >     int type = ak->type;
718.       BIO *pubkey = NULL;
719.   

test/evp_extra_test.c:718:5: 
716.       int expected_param_check = ak->param_check;
717.       int type = ak->type;
718. >     BIO *pubkey = NULL;
719.   
720.       p = input;

test/evp_extra_test.c:720:5: 
718.       BIO *pubkey = NULL;
719.   
720. >     p = input;
721.   
722.       if (type == 0 &&

test/evp_extra_test.c:722:9: Taking false branch
720.       p = input;
721.   
722.       if (type == 0 &&
               ^
723.               (!TEST_ptr(pkey = d2i_AutoPrivateKey(NULL, &p, input_len))
724.                || !TEST_ptr_eq(p, input + input_len)

test/evp_extra_test.c:729:9: Taking false branch
727.   
728.   #ifndef OPENSSL_NO_EC
729.       if (type == 1 &&
               ^
730.               (!TEST_ptr(pubkey = BIO_new_mem_buf(input, input_len))
731.                || !TEST_ptr(eckey = d2i_EC_PUBKEY_bio(pubkey, NULL))

test/evp_extra_test.c:736:9: Taking false branch
734.           goto done;
735.   
736.       if (type == 2 &&
               ^
737.               (!TEST_ptr(eckey = d2i_ECParameters(NULL, &p, input_len))
738.                || !TEST_ptr_eq(p, input + input_len)

test/evp_extra_test.c:744:10: 
742.   #endif
743.   
744. >     if (!TEST_ptr(ctx = EVP_PKEY_CTX_new(pkey, NULL)))
745.           goto done;
746.   

crypto/evp/pmeth_lib.c:241:1: start of procedure EVP_PKEY_CTX_new()
  239.   }
  240.   
  241. > EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e)
  242.   {
  243.       return int_ctx_new(pkey, e, -1);

crypto/evp/pmeth_lib.c:243:5: 
  241.   EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e)
  242.   {
  243. >     return int_ctx_new(pkey, e, -1);
  244.   }
  245.   

crypto/evp/pmeth_lib.c:103:1: start of procedure int_ctx_new()
    101.   }
    102.   
    103. > static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
    104.   {
    105.       EVP_PKEY_CTX *ret;

crypto/evp/pmeth_lib.c:108:9: Taking true branch
    106.       const EVP_PKEY_METHOD *pmeth;
    107.   
    108.       if (id == -1) {
                   ^
    109.           id = pkey->type;
    110.       }

crypto/evp/pmeth_lib.c:109:9: 
    107.   
    108.       if (id == -1) {
    109. >         id = pkey->type;
    110.       }
    111.   #ifndef OPENSSL_NO_ENGINE
