engines/e_4758_cca.c:566: error: NULL_DEREFERENCE
  pointer `keyToken` last assigned on line 564 could be null and is dereferenced at line 566, column 19.
Showing all 37 steps of the trace


engines/e_4758_cca.c:550:1: start of procedure cca_rsa_pub_enc()
548.   	}
549.   
550. > static int cca_rsa_pub_enc(int flen, const unsigned char *from,
551.   			unsigned char *to, RSA *rsa,int padding)
552.   	{

engines/e_4758_cca.c:555:2: 
553.   	long returnCode;
554.   	long reasonCode;
555. > 	long lflen = flen;
556.   	long exitDataLength = 0;
557.   	unsigned char exitData[8];

engines/e_4758_cca.c:556:2: 
554.   	long reasonCode;
555.   	long lflen = flen;
556. > 	long exitDataLength = 0;
557.   	unsigned char exitData[8];
558.   	long ruleArrayLength = 1;

engines/e_4758_cca.c:558:2: 
556.   	long exitDataLength = 0;
557.   	unsigned char exitData[8];
558. > 	long ruleArrayLength = 1;
559.   	unsigned char ruleArray[8] = "PKCS-1.2";
560.   	long dataStructureLength = 0;

engines/e_4758_cca.c:559:2: 
557.   	unsigned char exitData[8];
558.   	long ruleArrayLength = 1;
559. > 	unsigned char ruleArray[8] = "PKCS-1.2";
560.   	long dataStructureLength = 0;
561.   	unsigned char dataStructure[8];

engines/e_4758_cca.c:560:2: 
558.   	long ruleArrayLength = 1;
559.   	unsigned char ruleArray[8] = "PKCS-1.2";
560. > 	long dataStructureLength = 0;
561.   	unsigned char dataStructure[8];
562.   	long outputLength = RSA_size(rsa);

engines/e_4758_cca.c:562:2: 
560.   	long dataStructureLength = 0;
561.   	unsigned char dataStructure[8];
562. > 	long outputLength = RSA_size(rsa);
563.   	long keyTokenLength;
564.   	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);

crypto/rsa/rsa_lib.c:272:1: start of procedure RSA_size()
  270.   	}
  271.   
  272. > int RSA_size(const RSA *r)
  273.   	{
  274.   	return(BN_num_bytes(r->n));

crypto/rsa/rsa_lib.c:274:2: 
  272.   int RSA_size(const RSA *r)
  273.   	{
  274. > 	return(BN_num_bytes(r->n));
  275.   	}
  276.   

crypto/bn/bn_lib.c:245:1: start of procedure BN_num_bits()
    243.   	}
    244.   
    245. > int BN_num_bits(const BIGNUM *a)
    246.   	{
    247.   	int i = a->top - 1;

crypto/bn/bn_lib.c:247:2: 
    245.   int BN_num_bits(const BIGNUM *a)
    246.   	{
    247. > 	int i = a->top - 1;
    248.   	bn_check_top(a);
    249.   

crypto/bn/bn_lib.c:250:6: Taking false branch
    248.   	bn_check_top(a);
    249.   
    250.   	if (BN_is_zero(a)) return 0;
                ^
    251.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    252.   	}

crypto/bn/bn_lib.c:250:6: Taking true branch
    248.   	bn_check_top(a);
    249.   
    250.   	if (BN_is_zero(a)) return 0;
                ^
    251.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    252.   	}

crypto/bn/bn_lib.c:250:6: Taking false branch
    248.   	bn_check_top(a);
    249.   
    250.   	if (BN_is_zero(a)) return 0;
                ^
    251.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    252.   	}

crypto/bn/bn_lib.c:251:2: Skipping BN_num_bits_word(): empty list of specs
    249.   
    250.   	if (BN_is_zero(a)) return 0;
    251.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
            ^
    252.   	}
    253.   

crypto/bn/bn_lib.c:252:2: return from a call to BN_num_bits
    250.   	if (BN_is_zero(a)) return 0;
    251.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    252.   	}
            ^
    253.   
    254.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_lib.c:275:2: return from a call to RSA_size
  273.   	{
  274.   	return(BN_num_bytes(r->n));
  275.   	}
          ^
  276.   
  277.   int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,

engines/e_4758_cca.c:564:2: 
562.   	long outputLength = RSA_size(rsa);
563.   	long keyTokenLength;
564. > 	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
565.   
566.   	keyTokenLength = *(long*)keyToken;

crypto/rsa/rsa_lib.c:267:1: start of procedure RSA_get_ex_data()
  265.   	}
  266.   
  267. > void *RSA_get_ex_data(const RSA *r, int idx)
  268.   	{
  269.   	return(CRYPTO_get_ex_data(&r->ex_data,idx));

crypto/rsa/rsa_lib.c:269:2: 
  267.   void *RSA_get_ex_data(const RSA *r, int idx)
  268.   	{
  269. > 	return(CRYPTO_get_ex_data(&r->ex_data,idx));
  270.   	}
  271.   

crypto/ex_data.c:622:1: start of procedure CRYPTO_get_ex_data()
    620.   /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a
    621.    * particular index in the class used by this variable */
    622. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    623.   	{
    624.   	if (ad->sk == NULL)

crypto/ex_data.c:624:6: Taking false branch
    622.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    623.   	{
    624.   	if (ad->sk == NULL)
                ^
    625.   		return(0);
    626.   	else if (idx >= sk_num(ad->sk))

crypto/ex_data.c:626:11: 
    624.   	if (ad->sk == NULL)
    625.   		return(0);
    626. > 	else if (idx >= sk_num(ad->sk))
    627.   		return(0);
    628.   	else

crypto/stack/stack.c:301:1: start of procedure sk_num()
      299.   	}
      300.   
      301. > int sk_num(const STACK *st)
      302.   {
      303.   	if(st == NULL) return -1;

crypto/stack/stack.c:303:5: Taking false branch
      301.   int sk_num(const STACK *st)
      302.   {
      303.   	if(st == NULL) return -1;
                 ^
      304.   	return st->num;
      305.   }

crypto/stack/stack.c:304:2: 
      302.   {
      303.   	if(st == NULL) return -1;
      304. > 	return st->num;
      305.   }
      306.   

crypto/stack/stack.c:305:1: return from a call to sk_num
      303.   	if(st == NULL) return -1;
      304.   	return st->num;
      305. > }
      306.   
      307.   char *sk_value(const STACK *st, int i)

crypto/ex_data.c:626:11: Taking false branch
    624.   	if (ad->sk == NULL)
    625.   		return(0);
    626.   	else if (idx >= sk_num(ad->sk))
                     ^
    627.   		return(0);
    628.   	else

crypto/ex_data.c:629:3: 
    627.   		return(0);
    628.   	else
    629. > 		return(sk_value(ad->sk,idx));
    630.   	}
    631.   

crypto/stack/stack.c:307:1: start of procedure sk_value()
      305.   }
      306.   
      307. > char *sk_value(const STACK *st, int i)
      308.   {
      309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:309:6: Taking false branch
      307.   char *sk_value(const STACK *st, int i)
      308.   {
      309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                  ^
      310.   	return st->data[i];
      311.   }

crypto/stack/stack.c:309:13: Taking true branch
      307.   char *sk_value(const STACK *st, int i)
      308.   {
      309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                         ^
      310.   	return st->data[i];
      311.   }

crypto/stack/stack.c:309:39: 
      307.   char *sk_value(const STACK *st, int i)
      308.   {
      309. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
      310.   	return st->data[i];
      311.   }

crypto/stack/stack.c:311:1: return from a call to sk_value
      309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
      310.   	return st->data[i];
      311. > }
      312.   
      313.   char *sk_set(STACK *st, int i, char *value)

crypto/ex_data.c:630:2: return from a call to CRYPTO_get_ex_data
    628.   	else
    629.   		return(sk_value(ad->sk,idx));
    630.   	}
            ^
    631.   
    632.   IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS)

crypto/rsa/rsa_lib.c:270:2: return from a call to RSA_get_ex_data
  268.   	{
  269.   	return(CRYPTO_get_ex_data(&r->ex_data,idx));
  270.   	}
          ^
  271.   
  272.   int RSA_size(const RSA *r)

engines/e_4758_cca.c:566:2: 
564.   	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
565.   
566. > 	keyTokenLength = *(long*)keyToken;
567.   	keyToken+=sizeof(long);
568.   
