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


crypto/pkcs7/pk7_doit.c:803:1: start of procedure PKCS7_get_issuer_and_serial()
801.   	}
802.   
803. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
804.   	{
805.   	STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:809:2: 
807.   	int i;
808.   
809. > 	i=OBJ_obj2nid(p7->type);
810.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
811.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

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

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

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

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

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

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

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

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.   void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func)

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

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

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

crypto/pkcs7/pk7_doit.c:810:6: Taking false branch
808.   
809.   	i=OBJ_obj2nid(p7->type);
810.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
            ^
811.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
812.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);

crypto/pkcs7/pk7_doit.c:811:2: 
809.   	i=OBJ_obj2nid(p7->type);
810.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
811. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
812.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
813.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);

crypto/pkcs7/pk7_doit.c:812:2: 
810.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
811.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
812. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
813.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
814.   	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:813:6: 
811.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
812.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
813. > 	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
814.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
815.   	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:813:6: Taking false branch
811.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
812.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
813.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
            ^
814.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
815.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:814:2: 
812.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
813.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
814. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
815.   	return(ri->issuer_and_serial);
816.   	}

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:815:2: 
813.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
814.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
815. > 	return(ri->issuer_and_serial);
816.   	}
817.   

PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
	{
	STACK_OF(PKCS7_RECIP_INFO) *rsk;
	PKCS7_RECIP_INFO *ri;
	int i;
	i=OBJ_obj2nid(p7->type);
	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
	rsk=p7->d.signed_and_enveloped->recipientinfo;
	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
	return(ri->issuer_and_serial);
	}
['PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)\n\t{\n\tSTACK_OF(PKCS7_RECIP_INFO) *rsk;\n\tPKCS7_RECIP_INFO *ri;\n\tint i;\n\ti=OBJ_obj2nid(p7->type);\n\tif (i != NID_pkcs7_signedAndEnveloped) return(NULL);\n\trsk=p7->d.signed_and_enveloped->recipientinfo;\n\tri=sk_PKCS7_RECIP_INFO_value(rsk,0);\n\tif (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);\n\tri=sk_PKCS7_RECIP_INFO_value(rsk,idx);\n\treturn(ri->issuer_and_serial);\n\t}', 'int OBJ_obj2nid(const ASN1_OBJECT *a)\n\t{\n\tASN1_OBJECT **op;\n\tADDED_OBJ ad,*adp;\n\tif (a == NULL)\n\t\treturn(NID_undef);\n\tif (a->nid != 0)\n\t\treturn(a->nid);\n\tif (added != NULL)\n\t\t{\n\t\tad.type=ADDED_DATA;\n\t\tad.obj=(ASN1_OBJECT *)a;\n\t\tadp=(ADDED_OBJ *)lh_retrieve(added,&ad);\n\t\tif (adp != NULL) return (adp->obj->nid);\n\t\t}\n\top=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,\n\t\tsizeof(ASN1_OBJECT *),obj_cmp);\n\tif (op == NULL)\n\t\treturn(NID_undef);\n\treturn((*op)->nid);\n\t}', 'void *lh_retrieve(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE **rn;\n\tconst void *ret;\n\tlh->error=0;\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tlh->num_retrieve_miss++;\n\t\treturn(NULL);\n\t\t}\n\telse\n\t\t{\n\t\tret= (*rn)->data;\n\t\tlh->num_retrieve++;\n\t\t}\n\treturn((void *)ret);\n\t}', 'char *sk_value(const STACK *st, int i)\n{\n\tif(st == NULL) return NULL;\n\treturn st->data[i];\n}', 'int sk_num(const STACK *st)\n{\n\tif(st == NULL) return -1;\n\treturn st->num;\n}']