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


engines/e_4758cca.c:562:1: start of procedure cca_rsa_pub_enc()
560.   	}
561.   
562. > static int cca_rsa_pub_enc(int flen, const unsigned char *from,
563.   			unsigned char *to, RSA *rsa,int padding)
564.   	{

engines/e_4758cca.c:567:2: 
565.   	long returnCode;
566.   	long reasonCode;
567. > 	long lflen = flen;
568.   	long exitDataLength = 0;
569.   	unsigned char exitData[8];

engines/e_4758cca.c:568:2: 
566.   	long reasonCode;
567.   	long lflen = flen;
568. > 	long exitDataLength = 0;
569.   	unsigned char exitData[8];
570.   	long ruleArrayLength = 1;

engines/e_4758cca.c:570:2: 
568.   	long exitDataLength = 0;
569.   	unsigned char exitData[8];
570. > 	long ruleArrayLength = 1;
571.   	unsigned char ruleArray[8] = "PKCS-1.2";
572.   	long dataStructureLength = 0;

engines/e_4758cca.c:571:2: 
569.   	unsigned char exitData[8];
570.   	long ruleArrayLength = 1;
571. > 	unsigned char ruleArray[8] = "PKCS-1.2";
572.   	long dataStructureLength = 0;
573.   	unsigned char dataStructure[8];

engines/e_4758cca.c:572:2: 
570.   	long ruleArrayLength = 1;
571.   	unsigned char ruleArray[8] = "PKCS-1.2";
572. > 	long dataStructureLength = 0;
573.   	unsigned char dataStructure[8];
574.   	long outputLength = RSA_size(rsa);

engines/e_4758cca.c:574:2: 
572.   	long dataStructureLength = 0;
573.   	unsigned char dataStructure[8];
574. > 	long outputLength = RSA_size(rsa);
575.   	long keyTokenLength;
576.   	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);

crypto/rsa/rsa_crpt.c:70:1: start of procedure RSA_size()
  68.   #endif
  69.   
  70. > int RSA_size(const RSA *r)
  71.   	{
  72.   	return(BN_num_bytes(r->n));

crypto/rsa/rsa_crpt.c:72:2: 
  70.   int RSA_size(const RSA *r)
  71.   	{
  72. > 	return(BN_num_bytes(r->n));
  73.   	}
  74.   

crypto/bn/bn_lib.c:229:1: start of procedure BN_num_bits()
    227.   	}
    228.   
    229. > int BN_num_bits(const BIGNUM *a)
    230.   	{
    231.   	int i = a->top - 1;

crypto/bn/bn_lib.c:231:2: 
    229.   int BN_num_bits(const BIGNUM *a)
    230.   	{
    231. > 	int i = a->top - 1;
    232.   	bn_check_top(a);
    233.   

crypto/bn/bn_lib.c:234:6: Taking false branch
    232.   	bn_check_top(a);
    233.   
    234.   	if (BN_is_zero(a)) return 0;
                ^
    235.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    236.   	}

crypto/bn/bn_lib.c:235:2: Skipping BN_num_bits_word(): empty list of specs
    233.   
    234.   	if (BN_is_zero(a)) return 0;
    235.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
            ^
    236.   	}
    237.   

crypto/bn/bn_lib.c:236:2: return from a call to BN_num_bits
    234.   	if (BN_is_zero(a)) return 0;
    235.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    236.   	}
            ^
    237.   
    238.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_crpt.c:73:2: return from a call to RSA_size
  71.   	{
  72.   	return(BN_num_bytes(r->n));
  73.   	}
         ^
  74.   
  75.   int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,

engines/e_4758cca.c:576:2: 
574.   	long outputLength = RSA_size(rsa);
575.   	long keyTokenLength;
576. > 	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
577.   
578.   	keyTokenLength = *(long*)keyToken;

crypto/rsa/rsa_lib.c:278:1: start of procedure RSA_get_ex_data()
  276.   	}
  277.   
  278. > void *RSA_get_ex_data(const RSA *r, int idx)
  279.   	{
  280.   	return(CRYPTO_get_ex_data(&r->ex_data,idx));

crypto/rsa/rsa_lib.c:280:2: 
  278.   void *RSA_get_ex_data(const RSA *r, int idx)
  279.   	{
  280. > 	return(CRYPTO_get_ex_data(&r->ex_data,idx));
  281.   	}
  282.   

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

crypto/ex_data.c:628:6: Taking false branch
    626.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    627.   	{
    628.   	if (ad->sk == NULL)
                ^
    629.   		return(0);
    630.   	else if (idx >= sk_void_num(ad->sk))

crypto/ex_data.c:630:18: Condition is true
    628.   	if (ad->sk == NULL)
    629.   		return(0);
    630.   	else if (idx >= sk_void_num(ad->sk))
                            ^
    631.   		return(0);
    632.   	else

crypto/ex_data.c:630:11: 
    628.   	if (ad->sk == NULL)
    629.   		return(0);
    630. > 	else if (idx >= sk_void_num(ad->sk))
    631.   		return(0);
    632.   	else

crypto/stack/stack.c:294:1: start of procedure sk_num()
      292.   	}
      293.   
      294. > int sk_num(const _STACK *st)
      295.   {
      296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
      294.   int sk_num(const _STACK *st)
      295.   {
      296.   	if(st == NULL) return -1;
                 ^
      297.   	return st->num;
      298.   }

crypto/stack/stack.c:297:2: 
      295.   {
      296.   	if(st == NULL) return -1;
      297. > 	return st->num;
      298.   }
      299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
      296.   	if(st == NULL) return -1;
      297.   	return st->num;
      298. > }
      299.   
      300.   void *sk_value(const _STACK *st, int i)

crypto/ex_data.c:630:11: Taking false branch
    628.   	if (ad->sk == NULL)
    629.   		return(0);
    630.   	else if (idx >= sk_void_num(ad->sk))
                     ^
    631.   		return(0);
    632.   	else

crypto/ex_data.c:633:10: Condition is true
    631.   		return(0);
    632.   	else
    633.   		return(sk_void_value(ad->sk,idx));
                    ^
    634.   	}
    635.   

crypto/ex_data.c:633:3: 
    631.   		return(0);
    632.   	else
    633. > 		return(sk_void_value(ad->sk,idx));
    634.   	}
    635.   

crypto/stack/stack.c:300:1: start of procedure sk_value()
      298.   }
      299.   
      300. > void *sk_value(const _STACK *st, int i)
      301.   {
      302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
      300.   void *sk_value(const _STACK *st, int i)
      301.   {
      302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                  ^
      303.   	return st->data[i];
      304.   }

crypto/stack/stack.c:302:13: Taking true branch
      300.   void *sk_value(const _STACK *st, int i)
      301.   {
      302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                         ^
      303.   	return st->data[i];
      304.   }

crypto/stack/stack.c:302:39: 
      300.   void *sk_value(const _STACK *st, int i)
      301.   {
      302. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
      303.   	return st->data[i];
      304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
      302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
      303.   	return st->data[i];
      304. > }
      305.   
      306.   void *sk_set(_STACK *st, int i, void *value)

crypto/ex_data.c:634:2: return from a call to CRYPTO_get_ex_data
    632.   	else
    633.   		return(sk_void_value(ad->sk,idx));
    634.   	}
            ^
    635.   
    636.   IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS)

crypto/rsa/rsa_lib.c:281:2: return from a call to RSA_get_ex_data
  279.   	{
  280.   	return(CRYPTO_get_ex_data(&r->ex_data,idx));
  281.   	}
          ^
  282.   
  283.   int RSA_memory_lock(RSA *r)

engines/e_4758cca.c:578:2: 
576.   	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
577.   
578. > 	keyTokenLength = *(long*)keyToken;
579.   	keyToken+=sizeof(long);
580.   
