engines/ccgost/gost2001_keyx.c:45: error: NULL_DEREFERENCE
  pointer `out` last assigned on line 43 could be null and is dereferenced by call to `EC_KEY_set_private_key()` at line 45, column 2.
Showing all 37 steps of the trace


engines/ccgost/gost2001_keyx.c:41:1: start of procedure make_ec_ephemeral_key()
39.   
40.   /* Create gost 2001 ephemeral key with same parameters as peer key */
41. > static EC_KEY *make_ec_ephemeral_key(EC_KEY *peer_key,BIGNUM *seckey)
42.   	{
43.   	EC_KEY *out = EC_KEY_new();

engines/ccgost/gost2001_keyx.c:43:2: 
41.   static EC_KEY *make_ec_ephemeral_key(EC_KEY *peer_key,BIGNUM *seckey)
42.   	{
43. > 	EC_KEY *out = EC_KEY_new();
44.   	EC_KEY_copy(out,peer_key);
45.   	EC_KEY_set_private_key(out,seckey);

crypto/ec/ec_key.c:69:1: start of procedure EC_KEY_new()
  67.   #include <string.h>
  68.   
  69. > EC_KEY *EC_KEY_new(void)
  70.   	{
  71.   	EC_KEY *ret;

crypto/ec/ec_key.c:73:2: 
  71.   	EC_KEY *ret;
  72.   
  73. > 	ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
  74.   	if (ret == NULL)
  75.   		{

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

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

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

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

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

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

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

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

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

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

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

crypto/mem.c:323:2: 
    321.   #endif
    322.   
    323. > 	return ret;
    324.   	}
    325.   

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

crypto/ec/ec_key.c:74:6: Taking true branch
  72.   
  73.   	ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
  74.   	if (ret == NULL)
             ^
  75.   		{
  76.   		ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);

crypto/ec/ec_key.c:76:3: 
  74.   	if (ret == NULL)
  75.   		{
  76. > 		ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
  77.   		return(NULL);
  78.   		}

crypto/err/err.c:680:1: start of procedure ERR_put_error()
    678.   /********************************************************/
    679.   
    680. > void ERR_put_error(int lib, int func, int reason, const char *file,
    681.   	     int line)
    682.   	{

crypto/err/err.c:704:2: Skipping ERR_get_state(): empty list of specs
    702.   	}
    703.   #endif
    704.   	es=ERR_get_state();
            ^
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:706:2: 
    704.   	es=ERR_get_state();
    705.   
    706. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:707:6: Taking false branch
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
                ^
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;

crypto/err/err.c:709:2: 
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709. > 	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;

crypto/err/err.c:710:2: 
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;
    710. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;

crypto/err/err.c:711:2: 
    709.   	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711. > 	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);

crypto/err/err.c:712:2: 
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712. > 	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}

crypto/err/err.c:713:2: Taking true branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Taking false branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Loop condition is false. Leaving loop
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:714:2: return from a call to ERR_put_error
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}
            ^
    715.   
    716.   void ERR_clear_error(void)

crypto/ec/ec_key.c:77:3: 
  75.   		{
  76.   		ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
  77. > 		return(NULL);
  78.   		}
  79.   

crypto/ec/ec_key.c:89:2: return from a call to EC_KEY_new
  87.   	ret->method_data = NULL;
  88.   	return(ret);
  89.   	}
         ^
  90.   
  91.   EC_KEY *EC_KEY_new_by_curve_name(int nid)

engines/ccgost/gost2001_keyx.c:44:2: Skipping EC_KEY_copy(): empty list of specs
42.   	{
43.   	EC_KEY *out = EC_KEY_new();
44.   	EC_KEY_copy(out,peer_key);
       ^
45.   	EC_KEY_set_private_key(out,seckey);
46.   	gost2001_compute_public(out);

engines/ccgost/gost2001_keyx.c:45:2: 
43.   	EC_KEY *out = EC_KEY_new();
44.   	EC_KEY_copy(out,peer_key);
45. > 	EC_KEY_set_private_key(out,seckey);
46.   	gost2001_compute_public(out);
47.   	return out;

crypto/ec/ec_key.c:394:1: start of procedure EC_KEY_set_private_key()
  392.   	}
  393.   
  394. > int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key)
  395.   	{
  396.   	if (key->priv_key)

crypto/ec/ec_key.c:396:6: Taking false branch
  394.   int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key)
  395.   	{
  396.   	if (key->priv_key)
              ^
  397.   		BN_clear_free(key->priv_key);
  398.   	key->priv_key = BN_dup(priv_key);

static EC_KEY *make_ec_ephemeral_key(EC_KEY *peer_key,BIGNUM *seckey)
	{
	EC_KEY *out = EC_KEY_new();
	EC_KEY_copy(out,peer_key);
	EC_KEY_set_private_key(out,seckey);
	gost2001_compute_public(out);
	return out;
	}
['static EC_KEY *make_ec_ephemeral_key(EC_KEY *peer_key,BIGNUM *seckey)\n\t{\n\tEC_KEY *out = EC_KEY_new();\n\tEC_KEY_copy(out,peer_key);\n\tEC_KEY_set_private_key(out,seckey);\n\tgost2001_compute_public(out);\n\treturn out;\n\t}', 'EC_KEY *EC_KEY_new(void)\n\t{\n\tEC_KEY *ret;\n\tret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));\n\tif (ret == NULL)\n\t\t{\n\t\tECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->version = 1;\n\tret->group   = NULL;\n\tret->pub_key = NULL;\n\tret->priv_key= NULL;\n\tret->enc_flag= 0;\n\tret->conv_form = POINT_CONVERSION_UNCOMPRESSED;\n\tret->references= 1;\n\tret->method_data = NULL;\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tif (num <= 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n        if(ret && (num > 2048))\n\t{\textern unsigned char cleanse_ctr;\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\t}\n#endif\n\treturn ret;\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_flags[es->top]=0;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}', 'int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key)\n\t{\n\tif (key->priv_key)\n\t\tBN_clear_free(key->priv_key);\n\tkey->priv_key = BN_dup(priv_key);\n\treturn (key->priv_key == NULL) ? 0 : 1;\n\t}']