engines/ccgost/gost_sign.c:306: error: NULL_DEREFERENCE
  pointer `b` last assigned on line 305 could be null and is dereferenced by call to `BN_set_word()` at line 306, column 3.
Showing all 50 steps of the trace


engines/ccgost/gost_sign.c:293:1: start of procedure getbnfrombuf()
291.   
292.   /* Convert byte buffer to bignum, skipping leading zeros*/
293. > BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)

engines/ccgost/gost_sign.c:295:9: Loop condition is true. Entering loop body
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
               ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:295:18: Loop condition is true. Entering loop body
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
                        ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:297:3: 
295.   	while (*buf==0&&len>0)
296.   		{
297. > 		buf++; len--;
298.   		}
299.   	if (len)

engines/ccgost/gost_sign.c:297:10: 
295.   	while (*buf==0&&len>0)
296.   		{
297. > 		buf++; len--;
298.   		}
299.   	if (len)

engines/ccgost/gost_sign.c:295:9: Loop condition is true. Entering loop body
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
               ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:295:18: Loop condition is true. Entering loop body
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
                        ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:297:3: 
295.   	while (*buf==0&&len>0)
296.   		{
297. > 		buf++; len--;
298.   		}
299.   	if (len)

engines/ccgost/gost_sign.c:297:10: 
295.   	while (*buf==0&&len>0)
296.   		{
297. > 		buf++; len--;
298.   		}
299.   	if (len)

engines/ccgost/gost_sign.c:295:9: Loop condition is true. Entering loop body
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
               ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:295:18: Loop condition is true. Entering loop body
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
                        ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:297:3: 
295.   	while (*buf==0&&len>0)
296.   		{
297. > 		buf++; len--;
298.   		}
299.   	if (len)

engines/ccgost/gost_sign.c:297:10: 
295.   	while (*buf==0&&len>0)
296.   		{
297. > 		buf++; len--;
298.   		}
299.   	if (len)

engines/ccgost/gost_sign.c:295:9: Loop condition is false. Leaving loop
293.   BIGNUM *getbnfrombuf(const unsigned char *buf,size_t len)
294.   	{
295.   	while (*buf==0&&len>0)
               ^
296.   		{
297.   		buf++; len--;

engines/ccgost/gost_sign.c:299:6: Taking false branch
297.   		buf++; len--;
298.   		}
299.   	if (len)
            ^
300.   		{
301.   		return BN_bin2bn(buf,len,NULL);

engines/ccgost/gost_sign.c:305:3: 
303.   	else
304.   		{
305. > 		BIGNUM *b=BN_new();
306.   		BN_zero(b);
307.   		return b;

crypto/bn/bn_lib.c:298:1: start of procedure BN_new()
  296.   	}
  297.   
  298. > BIGNUM *BN_new(void)
  299.   	{
  300.   	BIGNUM *ret;

crypto/bn/bn_lib.c:302:6: 
  300.   	BIGNUM *ret;
  301.   
  302. > 	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);

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/bn/bn_lib.c:302:6: Taking true branch
  300.   	BIGNUM *ret;
  301.   
  302.   	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
              ^
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:304:3: 
  302.   	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
  303.   		{
  304. > 		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
  305.   		return(NULL);
  306.   		}

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/bn/bn_lib.c:305:3: 
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
  305. > 		return(NULL);
  306.   		}
  307.   	ret->flags=BN_FLG_MALLOCED;

crypto/bn/bn_lib.c:314:2: return from a call to BN_new
  312.   	bn_check_top(ret);
  313.   	return(ret);
  314.   	}
          ^
  315.   
  316.   /* This is used both by bn_expand2() and bn_dup_expand() */

engines/ccgost/gost_sign.c:306:3: 
304.   		{
305.   		BIGNUM *b=BN_new();
306. > 		BN_zero(b);
307.   		return b;
308.   		}

crypto/bn/bn_lib.c:586:1: start of procedure BN_set_word()
  584.   	}
  585.   
  586. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  587.   	{
  588.   	bn_check_top(a);

crypto/bn/bn_lib.c:589:6: 
  587.   	{
  588.   	bn_check_top(a);
  589. > 	if (bn_expand(a,(int)sizeof(BN_ULONG)*8) == NULL) return(0);
  590.   	a->neg = 0;
  591.   	a->d[0] = w;
