ssl/statem/statem_srvr.c:2697: error: NULL_DEREFERENCE
  pointer `pkey` last assigned on line 2680 could be null and is dereferenced by call to `EVP_PKEY_id()` at line 2697, column 12.
Showing all 54 steps of the trace


ssl/statem/statem_srvr.c:2658:1: start of procedure tls_process_cert_verify()
2656.   }
2657.   
2658. > MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
2659.   {
2660.       EVP_PKEY *pkey = NULL;

ssl/statem/statem_srvr.c:2660:5: 
2658.   MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
2659.   {
2660. >     EVP_PKEY *pkey = NULL;
2661.       const unsigned char *sig, *data;
2662.       unsigned char *gost_data = NULL;

ssl/statem/statem_srvr.c:2662:5: 
2660.       EVP_PKEY *pkey = NULL;
2661.       const unsigned char *sig, *data;
2662. >     unsigned char *gost_data = NULL;
2663.       int al, ret = MSG_PROCESS_ERROR;
2664.       int type = 0, j;

ssl/statem/statem_srvr.c:2663:5: 
2661.       const unsigned char *sig, *data;
2662.       unsigned char *gost_data = NULL;
2663. >     int al, ret = MSG_PROCESS_ERROR;
2664.       int type = 0, j;
2665.       unsigned int len;

ssl/statem/statem_srvr.c:2664:5: 
2662.       unsigned char *gost_data = NULL;
2663.       int al, ret = MSG_PROCESS_ERROR;
2664. >     int type = 0, j;
2665.       unsigned int len;
2666.       X509 *peer;

ssl/statem/statem_srvr.c:2667:5: 
2665.       unsigned int len;
2666.       X509 *peer;
2667. >     const EVP_MD *md = NULL;
2668.       long hdatalen = 0;
2669.       void *hdata;

ssl/statem/statem_srvr.c:2668:5: 
2666.       X509 *peer;
2667.       const EVP_MD *md = NULL;
2668. >     long hdatalen = 0;
2669.       void *hdata;
2670.   

ssl/statem/statem_srvr.c:2671:5: 
2669.       void *hdata;
2670.   
2671. >     EVP_MD_CTX *mctx = EVP_MD_CTX_new();
2672.   
2673.       if (mctx == NULL) {

crypto/evp/digest.c:152:1: start of procedure EVP_MD_CTX_new()
  150.   }
  151.   
  152. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:154:5: 
  152.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155.   }
  156.   

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:155:1: return from a call to EVP_MD_CTX_new
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155. > }
  156.   
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

ssl/statem/statem_srvr.c:2673:9: Taking false branch
2671.       EVP_MD_CTX *mctx = EVP_MD_CTX_new();
2672.   
2673.       if (mctx == NULL) {
                ^
2674.           SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE);
2675.           al = SSL_AD_INTERNAL_ERROR;

ssl/statem/statem_srvr.c:2679:5: 
2677.       }
2678.   
2679. >     peer = s->session->peer;
2680.       pkey = X509_get0_pubkey(peer);
2681.       type = X509_certificate_type(peer, pkey);

ssl/statem/statem_srvr.c:2680:5: 
2678.   
2679.       peer = s->session->peer;
2680. >     pkey = X509_get0_pubkey(peer);
2681.       type = X509_certificate_type(peer, pkey);
2682.   

crypto/x509/x509_cmp.c:307:1: start of procedure X509_get0_pubkey()
  305.   }
  306.   
  307. > EVP_PKEY *X509_get0_pubkey(X509 *x)
  308.   {
  309.       if (x == NULL)

crypto/x509/x509_cmp.c:309:9: Taking false branch
  307.   EVP_PKEY *X509_get0_pubkey(X509 *x)
  308.   {
  309.       if (x == NULL)
                 ^
  310.           return NULL;
  311.       return X509_PUBKEY_get0(x->cert_info.key);

crypto/x509/x509_cmp.c:311:5: 
  309.       if (x == NULL)
  310.           return NULL;
  311. >     return X509_PUBKEY_get0(x->cert_info.key);
  312.   }
  313.   

crypto/asn1/x_pubkey.c:124:1: start of procedure X509_PUBKEY_get0()
    122.   }
    123.   
    124. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    125.   {
    126.       EVP_PKEY *ret = NULL;

crypto/asn1/x_pubkey.c:126:5: 
    124.   EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    125.   {
    126. >     EVP_PKEY *ret = NULL;
    127.   
    128.       if (key == NULL)

crypto/asn1/x_pubkey.c:128:9: Taking true branch
    126.       EVP_PKEY *ret = NULL;
    127.   
    128.       if (key == NULL)
                   ^
    129.           goto error;
    130.   

crypto/asn1/x_pubkey.c:170:2: 
    168.       return ret;
    169.   
    170. >  error:
    171.       EVP_PKEY_free(ret);
    172.       return (NULL);

crypto/asn1/x_pubkey.c:171:5: 
    169.   
    170.    error:
    171. >     EVP_PKEY_free(ret);
    172.       return (NULL);
    173.   }

crypto/evp/p_lib.c:420:1: start of procedure EVP_PKEY_free()
      418.   }
      419.   
      420. > void EVP_PKEY_free(EVP_PKEY *x)
      421.   {
      422.       int i;

crypto/evp/p_lib.c:424:9: Taking true branch
      422.       int i;
      423.   
      424.       if (x == NULL)
                     ^
      425.           return;
      426.   

crypto/evp/p_lib.c:425:9: 
      423.   
      424.       if (x == NULL)
      425. >         return;
      426.   
      427.       i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_EVP_PKEY);

crypto/evp/p_lib.c:442:1: return from a call to EVP_PKEY_free
      440.       sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
      441.       OPENSSL_free(x);
      442. > }
      443.   
      444.   static void EVP_PKEY_free_it(EVP_PKEY *x)

crypto/asn1/x_pubkey.c:172:5: 
    170.    error:
    171.       EVP_PKEY_free(ret);
    172. >     return (NULL);
    173.   }
    174.   

crypto/asn1/x_pubkey.c:173:1: return from a call to X509_PUBKEY_get0
    171.       EVP_PKEY_free(ret);
    172.       return (NULL);
    173. > }
    174.   
    175.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)

crypto/x509/x509_cmp.c:312:1: return from a call to X509_get0_pubkey
  310.           return NULL;
  311.       return X509_PUBKEY_get0(x->cert_info.key);
  312. > }
  313.   
  314.   EVP_PKEY *X509_get_pubkey(X509 *x)

ssl/statem/statem_srvr.c:2681:5: Skipping X509_certificate_type(): empty list of specs
2679.       peer = s->session->peer;
2680.       pkey = X509_get0_pubkey(peer);
2681.       type = X509_certificate_type(peer, pkey);
            ^
2682.   
2683.       if (!(type & EVP_PKT_SIGN)) {

ssl/statem/statem_srvr.c:2683:11: Taking false branch
2681.       type = X509_certificate_type(peer, pkey);
2682.   
2683.       if (!(type & EVP_PKT_SIGN)) {
                  ^
2684.           SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY,
2685.                  SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);

ssl/statem/statem_srvr.c:2696:9: 
2694.        */
2695.   #ifndef OPENSSL_NO_GOST
2696. >     if (PACKET_remaining(pkt) == 64
2697.           && EVP_PKEY_id(pkey) == NID_id_GostR3410_2001) {
2698.           len = 64;

ssl/packet_locl.h:90:1: start of procedure PACKET_remaining()
  88.    * Returns the number of bytes remaining to be read in the PACKET
  89.    */
  90. > static ossl_inline size_t PACKET_remaining(const PACKET *pkt)
  91.   {
  92.       return pkt->remaining;

ssl/packet_locl.h:92:5: 
  90.   static ossl_inline size_t PACKET_remaining(const PACKET *pkt)
  91.   {
  92. >     return pkt->remaining;
  93.   }
  94.   

ssl/packet_locl.h:93:1: return from a call to PACKET_remaining
  91.   {
  92.       return pkt->remaining;
  93. > }
  94.   
  95.   /*

ssl/statem/statem_srvr.c:2696:9: Taking true branch
2694.        */
2695.   #ifndef OPENSSL_NO_GOST
2696.       if (PACKET_remaining(pkt) == 64
                ^
2697.           && EVP_PKEY_id(pkey) == NID_id_GostR3410_2001) {
2698.           len = 64;

ssl/statem/statem_srvr.c:2697:12: 
2695.   #ifndef OPENSSL_NO_GOST
2696.       if (PACKET_remaining(pkt) == 64
2697. >         && EVP_PKEY_id(pkey) == NID_id_GostR3410_2001) {
2698.           len = 64;
2699.       } else

crypto/evp/p_lib.c:410:1: start of procedure EVP_PKEY_id()
  408.   }
  409.   
  410. > int EVP_PKEY_id(const EVP_PKEY *pkey)
  411.   {
  412.       return pkey->type;

crypto/evp/p_lib.c:412:5: 
  410.   int EVP_PKEY_id(const EVP_PKEY *pkey)
  411.   {
  412. >     return pkey->type;
  413.   }
  414.   
