crypto/pkcs7/pk7_doit.c:869: error: NULL_DEREFERENCE
  pointer `ri` last assigned on line 868 could be null and is dereferenced at line 869, column 8.
Showing all 39 steps of the trace


crypto/pkcs7/pk7_doit.c:857:1: start of procedure PKCS7_get_issuer_and_serial()
855.   	}
856.   
857. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
858.   	{
859.   	STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:863:2: 
861.   	int i;
862.   
863. > 	i=OBJ_obj2nid(p7->type);
864.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
865.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

crypto/objects/obj_dat.c:366:1: start of procedure OBJ_obj2nid()
  364.   	}
  365.   
  366. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  367.   	{
  368.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:371:6: Taking false branch
  369.   	ADDED_OBJ ad,*adp;
  370.   
  371.   	if (a == NULL)
              ^
  372.   		return(NID_undef);
  373.   	if (a->nid != 0)

crypto/objects/obj_dat.c:373:6: Taking false branch
  371.   	if (a == NULL)
  372.   		return(NID_undef);
  373.   	if (a->nid != 0)
              ^
  374.   		return(a->nid);
  375.   

crypto/objects/obj_dat.c:376:6: Taking true branch
  374.   		return(a->nid);
  375.   
  376.   	if (added != NULL)
              ^
  377.   		{
  378.   		ad.type=ADDED_DATA;

crypto/objects/obj_dat.c:378:3: 
  376.   	if (added != NULL)
  377.   		{
  378. > 		ad.type=ADDED_DATA;
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);

crypto/objects/obj_dat.c:379:3: 
  377.   		{
  378.   		ad.type=ADDED_DATA;
  379. > 		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381.   		if (adp != NULL) return (adp->obj->nid);

crypto/objects/obj_dat.c:380:3: 
  378.   		ad.type=ADDED_DATA;
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380. > 		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381.   		if (adp != NULL) return (adp->obj->nid);
  382.   		}

crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
    246.   	}
    247.   
    248. > void *lh_retrieve(LHASH *lh, const void *data)
    249.   	{
    250.   	unsigned long hash;

crypto/lhash/lhash.c:254:2: 
    252.   	const void *ret;
    253.   
    254. > 	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
    256.   

crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
    253.   
    254.   	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
            ^
    256.   
    257.   	if (*rn == NULL)

crypto/lhash/lhash.c:257:6: Taking false branch
    255.   	rn=getrn(lh,data,&hash);
    256.   
    257.   	if (*rn == NULL)
                ^
    258.   		{
    259.   		lh->num_retrieve_miss++;

crypto/lhash/lhash.c:264:3: 
    262.   	else
    263.   		{
    264. > 		ret= (*rn)->data;
    265.   		lh->num_retrieve++;
    266.   		}

crypto/lhash/lhash.c:265:3: 
    263.   		{
    264.   		ret= (*rn)->data;
    265. > 		lh->num_retrieve++;
    266.   		}
    267.   	return((void *)ret);

crypto/lhash/lhash.c:267:2: 
    265.   		lh->num_retrieve++;
    266.   		}
    267. > 	return((void *)ret);
    268.   	}
    269.   

crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
    266.   		}
    267.   	return((void *)ret);
    268.   	}
            ^
    269.   
    270.   static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_dat.c:381:7: Taking true branch
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381.   		if (adp != NULL) return (adp->obj->nid);
               ^
  382.   		}
  383.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:381:20: 
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381. > 		if (adp != NULL) return (adp->obj->nid);
  382.   		}
  383.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:388:2: return from a call to OBJ_obj2nid
  386.   		return(NID_undef);
  387.   	return((*op)->nid);
  388.   	}
          ^
  389.   
  390.   /* Convert an object name into an ASN1_OBJECT

crypto/pkcs7/pk7_doit.c:864:6: Taking false branch
862.   
863.   	i=OBJ_obj2nid(p7->type);
864.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
            ^
865.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
866.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);

crypto/pkcs7/pk7_doit.c:865:2: 
863.   	i=OBJ_obj2nid(p7->type);
864.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
865. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
866.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);

crypto/pkcs7/pk7_doit.c:866:2: 
864.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
865.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
866. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);

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

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

crypto/stack/stack.c:310:17: 
  308.   char *sk_value(const STACK *st, int i)
  309.   {
  310. > 	if(st == NULL) return NULL;
  311.   	return st->data[i];
  312.   }

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

crypto/pkcs7/pk7_doit.c:867:6: 
865.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
866.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867. > 	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869.   	return(ri->issuer_and_serial);

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

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

crypto/stack/stack.c:304:17: 
  302.   int sk_num(const STACK *st)
  303.   {
  304. > 	if(st == NULL) return -1;
  305.   	return st->num;
  306.   }

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

crypto/pkcs7/pk7_doit.c:867:6: Taking false branch
865.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
866.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
            ^
868.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:868:2: 
866.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869.   	return(ri->issuer_and_serial);
870.   	}

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

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

crypto/stack/stack.c:310:17: 
  308.   char *sk_value(const STACK *st, int i)
  309.   {
  310. > 	if(st == NULL) return NULL;
  311.   	return st->data[i];
  312.   }

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

crypto/pkcs7/pk7_doit.c:869:2: 
867.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869. > 	return(ri->issuer_and_serial);
870.   	}
871.   
