engines/ccgost/gost_pmeth.c:105: error: NULL_DEREFERENCE
  pointer `pctx->shared_ukm` last assigned on line 104 could be null and is dereferenced by call to `memcpy()` at line 105, column 4.
Showing all 31 steps of the trace


engines/ccgost/gost_pmeth.c:72:1: start of procedure pkey_gost_ctrl()
70.   
71.   /* --------------------- control functions  ------------------------------*/
72. > static int pkey_gost_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
73.   	{
74.   	struct gost_pmeth_data *pctx = (struct gost_pmeth_data*)EVP_PKEY_CTX_get_data(ctx);

engines/ccgost/gost_pmeth.c:74:2: 
72.   static int pkey_gost_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
73.   	{
74. > 	struct gost_pmeth_data *pctx = (struct gost_pmeth_data*)EVP_PKEY_CTX_get_data(ctx);
75.   	switch (type)
76.   		{

crypto/evp/pmeth_lib.c:460:1: start of procedure EVP_PKEY_CTX_get_data()
  458.   	}
  459.   
  460. > void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
  461.   	{
  462.   	return ctx->data;

crypto/evp/pmeth_lib.c:462:2: 
  460.   void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
  461.   	{
  462. > 	return ctx->data;
  463.   	}
  464.   

crypto/evp/pmeth_lib.c:463:2: return from a call to EVP_PKEY_CTX_get_data
  461.   	{
  462.   	return ctx->data;
  463.   	}
          ^
  464.   
  465.   EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx)

engines/ccgost/gost_pmeth.c:75:2: 
73.   	{
74.   	struct gost_pmeth_data *pctx = (struct gost_pmeth_data*)EVP_PKEY_CTX_get_data(ctx);
75. > 	switch (type)
76.   		{
77.   		case EVP_PKEY_CTRL_MD:

engines/ccgost/gost_pmeth.c:77:3: Switch condition is false. Skipping switch case
75.   	switch (type)
76.   		{
77.   		case EVP_PKEY_CTRL_MD:
        ^
78.   		{
79.   		if (EVP_MD_type((const EVP_MD *)p2) != NID_id_GostR3411_94)

engines/ccgost/gost_pmeth.c:89:3: Switch condition is false. Skipping switch case
87.   		break;
88.   
89.   		case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
        ^
90.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
91.   		case EVP_PKEY_CTRL_PKCS7_SIGN:

engines/ccgost/gost_pmeth.c:90:3: Switch condition is false. Skipping switch case
88.   
89.   		case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
90.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
        ^
91.   		case EVP_PKEY_CTRL_PKCS7_SIGN:
92.   		case EVP_PKEY_CTRL_DIGESTINIT:

engines/ccgost/gost_pmeth.c:91:3: Switch condition is false. Skipping switch case
89.   		case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
90.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
91.   		case EVP_PKEY_CTRL_PKCS7_SIGN:
        ^
92.   		case EVP_PKEY_CTRL_DIGESTINIT:
93.   #ifndef OPENSSL_NO_CMS		

engines/ccgost/gost_pmeth.c:92:3: Switch condition is false. Skipping switch case
90.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
91.   		case EVP_PKEY_CTRL_PKCS7_SIGN:
92.   		case EVP_PKEY_CTRL_DIGESTINIT:
        ^
93.   #ifndef OPENSSL_NO_CMS		
94.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:

engines/ccgost/gost_pmeth.c:94:3: Switch condition is false. Skipping switch case
92.   		case EVP_PKEY_CTRL_DIGESTINIT:
93.   #ifndef OPENSSL_NO_CMS		
94.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:
        ^
95.   		case EVP_PKEY_CTRL_CMS_DECRYPT:
96.   		case EVP_PKEY_CTRL_CMS_SIGN:

engines/ccgost/gost_pmeth.c:95:3: Switch condition is false. Skipping switch case
93.   #ifndef OPENSSL_NO_CMS		
94.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:
95.   		case EVP_PKEY_CTRL_CMS_DECRYPT:
        ^
96.   		case EVP_PKEY_CTRL_CMS_SIGN:
97.   #endif		

engines/ccgost/gost_pmeth.c:96:3: Switch condition is false. Skipping switch case
94.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:
95.   		case EVP_PKEY_CTRL_CMS_DECRYPT:
96.   		case EVP_PKEY_CTRL_CMS_SIGN:
        ^
97.   #endif		
98.   			return 1;

engines/ccgost/gost_pmeth.c:100:3: Switch condition is false. Skipping switch case
98.   			return 1;
99.   
100.   		case EVP_PKEY_CTRL_GOST_PARAMSET:
         ^
101.   			pctx->sign_param_nid = (int)p1;
102.   			return 1;

engines/ccgost/gost_pmeth.c:103:3: Switch condition is true. Entering switch case
101.   			pctx->sign_param_nid = (int)p1;
102.   			return 1;
103.   		case EVP_PKEY_CTRL_SET_IV:
         ^
104.   			pctx->shared_ukm=OPENSSL_malloc((int)p1);
105.   			memcpy(pctx->shared_ukm,p2,(int) p1);

engines/ccgost/gost_pmeth.c:104:4: 
102.   			return 1;
103.   		case EVP_PKEY_CTRL_SET_IV:
104. > 			pctx->shared_ukm=OPENSSL_malloc((int)p1);
105.   			memcpy(pctx->shared_ukm,p2,(int) p1);
106.   			return 1;

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
  295.   	}
  296.   
  297. > void *CRYPTO_malloc(int num, const char *file, int line)
  298.   	{
  299.   	void *ret = NULL;

crypto/mem.c:299:2: 
  297.   void *CRYPTO_malloc(int num, const char *file, int line)
  298.   	{
  299. > 	void *ret = NULL;
  300.   
  301.   	if (num <= 0) return NULL;

crypto/mem.c:301:6: Taking false branch
  299.   	void *ret = NULL;
  300.   
  301.   	if (num <= 0) return NULL;
              ^
  302.   
  303.   	allow_customize = 0;

crypto/mem.c:303:2: 
  301.   	if (num <= 0) return NULL;
  302.   
  303. > 	allow_customize = 0;
  304.   	if (malloc_debug_func != NULL)
  305.   		{

crypto/mem.c:304:6: Taking true branch
  302.   
  303.   	allow_customize = 0;
  304.   	if (malloc_debug_func != NULL)
              ^
  305.   		{
  306.   		allow_customize_debug = 0;

crypto/mem.c:306:3: 
  304.   	if (malloc_debug_func != NULL)
  305.   		{
  306. > 		allow_customize_debug = 0;
  307.   		malloc_debug_func(NULL, num, file, line, 0);
  308.   		}

crypto/mem.c:307:3: Skipping __function_pointer__(): unresolved function pointer
  305.   		{
  306.   		allow_customize_debug = 0;
  307.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  308.   		}
  309.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:309:2: Skipping __function_pointer__(): unresolved function pointer
  307.   		malloc_debug_func(NULL, num, file, line, 0);
  308.   		}
  309.   	ret = malloc_ex_func(num,file,line);
          ^
  310.   #ifdef LEVITTE_DEBUG_MEM
  311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:313:6: Taking true branch
  311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  312.   #endif
  313.   	if (malloc_debug_func != NULL)
              ^
  314.   		malloc_debug_func(ret, num, file, line, 1);
  315.   

crypto/mem.c:314:3: Skipping __function_pointer__(): unresolved function pointer
  312.   #endif
  313.   	if (malloc_debug_func != NULL)
  314.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  315.   
  316.   #ifndef OPENSSL_CPUID_OBJ

crypto/mem.c:320:12: Taking false branch
  318.            * sanitisation function can't be optimised out. NB: We only do
  319.            * this for >2Kb so the overhead doesn't bother us. */
  320.           if(ret && (num > 2048))
                    ^
  321.   	{	extern unsigned char cleanse_ctr;
  322.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:326:2: 
  324.   #endif
  325.   
  326. > 	return ret;
  327.   	}
  328.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:327:2: return from a call to CRYPTO_malloc
  325.   
  326.   	return ret;
  327.   	}
          ^
  328.   char *CRYPTO_strdup(const char *str, const char *file, int line)
  329.   	{

engines/ccgost/gost_pmeth.c:105:4: 
103.   		case EVP_PKEY_CTRL_SET_IV:
104.   			pctx->shared_ukm=OPENSSL_malloc((int)p1);
105. > 			memcpy(pctx->shared_ukm,p2,(int) p1);
106.   			return 1;
107.   		case EVP_PKEY_CTRL_PEER_KEY:
