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


crypto/pkcs7/pk7_doit.c:1085:1: start of procedure PKCS7_get_issuer_and_serial()
1083.   	}
1084.   
1085. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1086.   	{
1087.   	STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:1091:2: 
1089.   	int i;
1090.   
1091. > 	i=OBJ_obj2nid(p7->type);
1092.   	if (i != NID_pkcs7_signedAndEnveloped)
1093.   		return NULL;

crypto/objects/obj_dat.c:387:1: start of procedure OBJ_obj2nid()
  385.   	}
  386.   
  387. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  388.   	{
  389.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:392:6: Taking false branch
  390.   	ADDED_OBJ ad,*adp;
  391.   
  392.   	if (a == NULL)
              ^
  393.   		return(NID_undef);
  394.   	if (a->nid != 0)

crypto/objects/obj_dat.c:394:6: Taking false branch
  392.   	if (a == NULL)
  393.   		return(NID_undef);
  394.   	if (a->nid != 0)
              ^
  395.   		return(a->nid);
  396.   

crypto/objects/obj_dat.c:397:6: Taking true branch
  395.   		return(a->nid);
  396.   
  397.   	if (added != NULL)
              ^
  398.   		{
  399.   		ad.type=ADDED_DATA;

crypto/objects/obj_dat.c:399:3: 
  397.   	if (added != NULL)
  398.   		{
  399. > 		ad.type=ADDED_DATA;
  400.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  401.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);

crypto/objects/obj_dat.c:400:3: 
  398.   		{
  399.   		ad.type=ADDED_DATA;
  400. > 		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  401.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  402.   		if (adp != NULL) return (adp->obj->nid);

crypto/objects/obj_dat.c:401:3: 
  399.   		ad.type=ADDED_DATA;
  400.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  401. > 		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  402.   		if (adp != NULL) return (adp->obj->nid);
  403.   		}

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.   	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(ret);

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

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

crypto/objects/obj_dat.c:402:7: Taking true branch
  400.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  401.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  402.   		if (adp != NULL) return (adp->obj->nid);
               ^
  403.   		}
  404.   	op=(ASN1_OBJECT **)OBJ_bsearch((const char *)&a,(const char *)obj_objs,

crypto/objects/obj_dat.c:402:20: 
  400.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  401.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  402. > 		if (adp != NULL) return (adp->obj->nid);
  403.   		}
  404.   	op=(ASN1_OBJECT **)OBJ_bsearch((const char *)&a,(const char *)obj_objs,

crypto/objects/obj_dat.c:409:2: return from a call to OBJ_obj2nid
  407.   		return(NID_undef);
  408.   	return((*op)->nid);
  409.   	}
          ^
  410.   
  411.   /* Convert an object name into an ASN1_OBJECT

crypto/pkcs7/pk7_doit.c:1092:6: Taking false branch
1090.   
1091.   	i=OBJ_obj2nid(p7->type);
1092.   	if (i != NID_pkcs7_signedAndEnveloped)
             ^
1093.   		return NULL;
1094.   	if (p7->d.signed_and_enveloped == NULL)

crypto/pkcs7/pk7_doit.c:1094:6: Taking false branch
1092.   	if (i != NID_pkcs7_signedAndEnveloped)
1093.   		return NULL;
1094.   	if (p7->d.signed_and_enveloped == NULL)
             ^
1095.   		return NULL;
1096.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

crypto/pkcs7/pk7_doit.c:1096:2: 
1094.   	if (p7->d.signed_and_enveloped == NULL)
1095.   		return NULL;
1096. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
1097.   	if (rsk == NULL)
1098.   		return NULL;

crypto/pkcs7/pk7_doit.c:1097:6: Taking false branch
1095.   		return NULL;
1096.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
1097.   	if (rsk == NULL)
             ^
1098.   		return NULL;
1099.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);

crypto/pkcs7/pk7_doit.c:1099:2: 
1097.   	if (rsk == NULL)
1098.   		return NULL;
1099. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1100.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1101.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);

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 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:24: 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:310:2: 
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  310. > 	return st->data[i];
  311.   }
  312.   

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/pkcs7/pk7_doit.c:1100:6: 
1098.   		return NULL;
1099.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1100. > 	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1101.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1102.   	return(ri->issuer_and_serial);

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/pkcs7/pk7_doit.c:1100:6: Taking false branch
1098.   		return NULL;
1099.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1100.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
             ^
1101.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1102.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:1101:2: 
1099.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1100.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1101. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1102.   	return(ri->issuer_and_serial);
1103.   	}

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/pkcs7/pk7_doit.c:1102:2: 
1100.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1101.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1102. > 	return(ri->issuer_and_serial);
1103.   	}
1104.   
