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


crypto/pkcs7/pk7_doit.c:825:1: start of procedure PKCS7_get_issuer_and_serial()
823.   	}
824.   
825. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
826.   	{
827.   	STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:831:2: 
829.   	int i;
830.   
831. > 	i=OBJ_obj2nid(p7->type);
832.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
833.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

crypto/objects/obj_dat.c:350:1: start of procedure OBJ_obj2nid()
  348.   	}
  349.   
  350. > int OBJ_obj2nid(ASN1_OBJECT *a)
  351.   	{
  352.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:355:6: Taking false branch
  353.   	ADDED_OBJ ad,*adp;
  354.   
  355.   	if (a == NULL)
              ^
  356.   		return(NID_undef);
  357.   	if (a->nid != 0)

crypto/objects/obj_dat.c:357:6: Taking true branch
  355.   	if (a == NULL)
  356.   		return(NID_undef);
  357.   	if (a->nid != 0)
              ^
  358.   		return(a->nid);
  359.   

crypto/objects/obj_dat.c:358:3: 
  356.   		return(NID_undef);
  357.   	if (a->nid != 0)
  358. > 		return(a->nid);
  359.   
  360.   	if (added != NULL)

crypto/objects/obj_dat.c:372:2: return from a call to OBJ_obj2nid
  370.   		return(NID_undef);
  371.   	return((*op)->nid);
  372.   	}
          ^
  373.   
  374.   /* Convert an object name into an ASN1_OBJECT

crypto/pkcs7/pk7_doit.c:832:6: Taking false branch
830.   
831.   	i=OBJ_obj2nid(p7->type);
832.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
            ^
833.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
834.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);

crypto/pkcs7/pk7_doit.c:833:2: 
831.   	i=OBJ_obj2nid(p7->type);
832.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
833. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
834.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
835.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);

crypto/pkcs7/pk7_doit.c:834:2: 
832.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
833.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
834. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
835.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
836.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);

crypto/asn1/p7_recip.c:124:1: start of procedure sk_PKCS7_RECIP_INFO_value()
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/stack/stack.c:289:1: start of procedure sk_value()
    287.   }
    288.   
    289. > char *sk_value(STACK *st, int i)
    290.   {
    291.   	if(st == NULL) return NULL;

crypto/stack/stack.c:291:5: Taking true branch
    289.   char *sk_value(STACK *st, int i)
    290.   {
    291.   	if(st == NULL) return NULL;
               ^
    292.   	return st->data[i];
    293.   }

crypto/stack/stack.c:291:17: 
    289.   char *sk_value(STACK *st, int i)
    290.   {
    291. > 	if(st == NULL) return NULL;
    292.   	return st->data[i];
    293.   }

crypto/stack/stack.c:293:1: return from a call to sk_value
    291.   	if(st == NULL) return NULL;
    292.   	return st->data[i];
    293. > }
    294.   
    295.   char *sk_set(STACK *st, int i, char *value)

crypto/asn1/p7_recip.c:124:1: return from a call to sk_PKCS7_RECIP_INFO_value
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/pkcs7/pk7_doit.c:835:6: 
833.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
834.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
835. > 	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
836.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
837.   	return(ri->issuer_and_serial);

crypto/asn1/p7_recip.c:124:1: start of procedure sk_PKCS7_RECIP_INFO_num()
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/asn1/p7_recip.c:124:1: Condition is false
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/asn1/p7_recip.c:124:1: return from a call to sk_PKCS7_RECIP_INFO_num
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/pkcs7/pk7_doit.c:835:6: Taking false branch
833.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
834.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
835.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
            ^
836.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
837.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:836:2: 
834.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
835.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
836. > 	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
837.   	return(ri->issuer_and_serial);
838.   	}

crypto/asn1/p7_recip.c:124:1: start of procedure sk_PKCS7_RECIP_INFO_value()
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/stack/stack.c:289:1: start of procedure sk_value()
    287.   }
    288.   
    289. > char *sk_value(STACK *st, int i)
    290.   {
    291.   	if(st == NULL) return NULL;

crypto/stack/stack.c:291:5: Taking true branch
    289.   char *sk_value(STACK *st, int i)
    290.   {
    291.   	if(st == NULL) return NULL;
               ^
    292.   	return st->data[i];
    293.   }

crypto/stack/stack.c:291:17: 
    289.   char *sk_value(STACK *st, int i)
    290.   {
    291. > 	if(st == NULL) return NULL;
    292.   	return st->data[i];
    293.   }

crypto/stack/stack.c:293:1: return from a call to sk_value
    291.   	if(st == NULL) return NULL;
    292.   	return st->data[i];
    293. > }
    294.   
    295.   char *sk_set(STACK *st, int i, char *value)

crypto/asn1/p7_recip.c:124:1: return from a call to sk_PKCS7_RECIP_INFO_value
  122.   	}
  123.   
  124. > IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
  125.   IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)

crypto/pkcs7/pk7_doit.c:837:2: 
835.   	if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
836.   	ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
837. > 	return(ri->issuer_and_serial);
838.   	}
839.   

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(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=a;\n\t\tadp=(ADDED_OBJ *)lh_retrieve(added,(char *)&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 *),(int (*)())obj_cmp);\n\tif (op == NULL)\n\t\treturn(NID_undef);\n\treturn((*op)->nid);\n\t}', 'IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)', 'char *sk_value(STACK *st, int i)\n{\n\tif(st == NULL) return NULL;\n\treturn st->data[i];\n}']