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


crypto/pkcs7/pk7_doit.c:1144:1: start of procedure PKCS7_get_issuer_and_serial()
1142.   	}
1143.   
1144. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1145.   	{
1146.   	STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:1150:2: 
1148.   	int i;
1149.   
1150. > 	i=OBJ_obj2nid(p7->type);
1151.   	if (i != NID_pkcs7_signedAndEnveloped)
1152.   		return NULL;

crypto/objects/obj_dat.c:398:1: start of procedure OBJ_obj2nid()
  396.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
  397.   
  398. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  399.   	{
  400.   	const unsigned int *op;

crypto/objects/obj_dat.c:403:6: Taking false branch
  401.   	ADDED_OBJ ad,*adp;
  402.   
  403.   	if (a == NULL)
              ^
  404.   		return(NID_undef);
  405.   	if (a->nid != 0)

crypto/objects/obj_dat.c:405:6: Taking false branch
  403.   	if (a == NULL)
  404.   		return(NID_undef);
  405.   	if (a->nid != 0)
              ^
  406.   		return(a->nid);
  407.   

crypto/objects/obj_dat.c:408:6: Taking true branch
  406.   		return(a->nid);
  407.   
  408.   	if (added != NULL)
              ^
  409.   		{
  410.   		ad.type=ADDED_DATA;

crypto/objects/obj_dat.c:410:3: 
  408.   	if (added != NULL)
  409.   		{
  410. > 		ad.type=ADDED_DATA;
  411.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);

crypto/objects/obj_dat.c:411:3: 
  409.   		{
  410.   		ad.type=ADDED_DATA;
  411. > 		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  413.   		if (adp != NULL) return (adp->obj->nid);

crypto/objects/obj_dat.c:412:7: Condition is true
  410.   		ad.type=ADDED_DATA;
  411.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
               ^
  413.   		if (adp != NULL) return (adp->obj->nid);
  414.   		}

crypto/objects/obj_dat.c:412:7: Condition is true
  410.   		ad.type=ADDED_DATA;
  411.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
               ^
  413.   		if (adp != NULL) return (adp->obj->nid);
  414.   		}

crypto/objects/obj_dat.c:412:3: 
  410.   		ad.type=ADDED_DATA;
  411.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412. > 		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  413.   		if (adp != NULL) return (adp->obj->nid);
  414.   		}

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:413:7: Taking true branch
  411.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  413.   		if (adp != NULL) return (adp->obj->nid);
               ^
  414.   		}
  415.   	op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);

crypto/objects/obj_dat.c:413:20: 
  411.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  412.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  413. > 		if (adp != NULL) return (adp->obj->nid);
  414.   		}
  415.   	op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);

crypto/objects/obj_dat.c:419:2: return from a call to OBJ_obj2nid
  417.   		return(NID_undef);
  418.   	return(nid_objs[*op].nid);
  419.   	}
          ^
  420.   
  421.   /* Convert an object name into an ASN1_OBJECT

crypto/pkcs7/pk7_doit.c:1151:6: Taking false branch
1149.   
1150.   	i=OBJ_obj2nid(p7->type);
1151.   	if (i != NID_pkcs7_signedAndEnveloped)
             ^
1152.   		return NULL;
1153.   	if (p7->d.signed_and_enveloped == NULL)

crypto/pkcs7/pk7_doit.c:1153:6: Taking false branch
1151.   	if (i != NID_pkcs7_signedAndEnveloped)
1152.   		return NULL;
1153.   	if (p7->d.signed_and_enveloped == NULL)
             ^
1154.   		return NULL;
1155.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

crypto/pkcs7/pk7_doit.c:1155:2: 
1153.   	if (p7->d.signed_and_enveloped == NULL)
1154.   		return NULL;
1155. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
1156.   	if (rsk == NULL)
1157.   		return NULL;

crypto/pkcs7/pk7_doit.c:1156:6: Taking false branch
1154.   		return NULL;
1155.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
1156.   	if (rsk == NULL)
             ^
1157.   		return NULL;
1158.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);

crypto/pkcs7/pk7_doit.c:1158:5: Condition is true
1156.   	if (rsk == NULL)
1157.   		return NULL;
1158.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
            ^
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1160.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);

crypto/pkcs7/pk7_doit.c:1158:2: 
1156.   	if (rsk == NULL)
1157.   		return NULL;
1158. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1160.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);

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 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:24: 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:303:2: 
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303. > 	return st->data[i];
  304.   }
  305.   

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/pkcs7/pk7_doit.c:1159:6: Condition is true
1157.   		return NULL;
1158.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
             ^
1160.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1161.   	return(ri->issuer_and_serial);

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/pkcs7/pk7_doit.c:1159:6: Taking false branch
1157.   		return NULL;
1158.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
             ^
1160.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1161.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:1160:5: Condition is true
1158.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1160.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
            ^
1161.   	return(ri->issuer_and_serial);
1162.   	}

crypto/pkcs7/pk7_doit.c:1160:2: 
1158.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1160. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1161.   	return(ri->issuer_and_serial);
1162.   	}

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/pkcs7/pk7_doit.c:1161:2: 
1159.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
1160.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
1161. > 	return(ri->issuer_and_serial);
1162.   	}
1163.   
