engines/ccgost/gost_pmeth.c:109: error: NULL_DEREFERENCE
  pointer `pctx->shared_ukm` last assigned on line 108 could be null and is dereferenced by call to `memcpy()` at line 109, column 4.
Showing all 32 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_GET_MD:
        ^
90.   		*(const EVP_MD **)p2 = pctx->md;
91.   		return 1;

engines/ccgost/gost_pmeth.c:93:3: Switch condition is false. Skipping switch case
91.   		return 1;
92.   
93.   		case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
        ^
94.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
95.   		case EVP_PKEY_CTRL_PKCS7_SIGN:

engines/ccgost/gost_pmeth.c:94:3: Switch condition is false. Skipping switch case
92.   
93.   		case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
94.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
        ^
95.   		case EVP_PKEY_CTRL_PKCS7_SIGN:
96.   		case EVP_PKEY_CTRL_DIGESTINIT:

engines/ccgost/gost_pmeth.c:95:3: Switch condition is false. Skipping switch case
93.   		case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
94.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
95.   		case EVP_PKEY_CTRL_PKCS7_SIGN:
        ^
96.   		case EVP_PKEY_CTRL_DIGESTINIT:
97.   #ifndef OPENSSL_NO_CMS		

engines/ccgost/gost_pmeth.c:96:3: Switch condition is false. Skipping switch case
94.   		case EVP_PKEY_CTRL_PKCS7_DECRYPT:
95.   		case EVP_PKEY_CTRL_PKCS7_SIGN:
96.   		case EVP_PKEY_CTRL_DIGESTINIT:
        ^
97.   #ifndef OPENSSL_NO_CMS		
98.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:

engines/ccgost/gost_pmeth.c:98:3: Switch condition is false. Skipping switch case
96.   		case EVP_PKEY_CTRL_DIGESTINIT:
97.   #ifndef OPENSSL_NO_CMS		
98.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:
         ^
99.   		case EVP_PKEY_CTRL_CMS_DECRYPT:
100.   		case EVP_PKEY_CTRL_CMS_SIGN:

engines/ccgost/gost_pmeth.c:99:3: Switch condition is false. Skipping switch case
97.   #ifndef OPENSSL_NO_CMS		
98.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:
99.   		case EVP_PKEY_CTRL_CMS_DECRYPT:
         ^
100.   		case EVP_PKEY_CTRL_CMS_SIGN:
101.   #endif		

engines/ccgost/gost_pmeth.c:100:3: Switch condition is false. Skipping switch case
98.   		case EVP_PKEY_CTRL_CMS_ENCRYPT:
99.   		case EVP_PKEY_CTRL_CMS_DECRYPT:
100.   		case EVP_PKEY_CTRL_CMS_SIGN:
         ^
101.   #endif		
102.   			return 1;

engines/ccgost/gost_pmeth.c:104:3: Switch condition is false. Skipping switch case
102.   			return 1;
103.   
104.   		case EVP_PKEY_CTRL_GOST_PARAMSET:
         ^
105.   			pctx->sign_param_nid = (int)p1;
106.   			return 1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

engines/ccgost/gost_pmeth.c:109:4: 
107.   		case EVP_PKEY_CTRL_SET_IV:
108.   			pctx->shared_ukm=OPENSSL_malloc((int)p1);
109. > 			memcpy(pctx->shared_ukm,p2,(int) p1);
110.   			return 1;
111.   		case EVP_PKEY_CTRL_PEER_KEY:
