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


crypto/pkcs7/pk7_doit.c:789:1: start of procedure PKCS7_get_issuer_and_serial()
787.   	}
788.   
789. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
790.   	{
791.   	STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:795:2: 
793.   	int i;
794.   
795. > 	i=OBJ_obj2nid(p7->type);
796.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
797.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

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

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

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

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

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

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

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

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

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

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

crypto/pkcs7/pk7_doit.c:796:6: Taking false branch
794.   
795.   	i=OBJ_obj2nid(p7->type);
796.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
            ^
797.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
798.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);

crypto/pkcs7/pk7_doit.c:797:2: 
795.   	i=OBJ_obj2nid(p7->type);
796.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
797. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
798.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
799.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);

crypto/pkcs7/pk7_doit.c:798:2: 
796.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
797.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
798. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
799.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
800.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);

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

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

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

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

crypto/pkcs7/pk7_doit.c:799:6: 
797.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
798.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
799. > 	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
800.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
801.   	return(ri->issuer_and_serial);

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

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

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

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

crypto/pkcs7/pk7_doit.c:799:6: Taking false branch
797.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
798.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
799.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
            ^
800.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
801.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:800:2: 
798.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
799.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
800. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
801.   	return(ri->issuer_and_serial);
802.   	}

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

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

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

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

crypto/pkcs7/pk7_doit.c:801:2: 
799.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
800.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
801. > 	return(ri->issuer_and_serial);
802.   	}
803.   
