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 26 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: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: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:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > char *sk_value(const STACK *st, int i)
  301.   {
  302.   	if(st == NULL) return NULL;

crypto/stack/stack.c:302:5: Taking true branch
  300.   char *sk_value(const STACK *st, int i)
  301.   {
  302.   	if(st == NULL) return NULL;
             ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:17: 
  300.   char *sk_value(const STACK *st, int i)
  301.   {
  302. > 	if(st == NULL) return NULL;
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(st == NULL) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   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: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 true branch
  294.   int sk_num(const STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:296:17: 
  294.   int sk_num(const STACK *st)
  295.   {
  296. > 	if(st == NULL) return -1;
  297.   	return st->num;
  298.   }

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.   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:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > char *sk_value(const STACK *st, int i)
  301.   {
  302.   	if(st == NULL) return NULL;

crypto/stack/stack.c:302:5: Taking true branch
  300.   char *sk_value(const STACK *st, int i)
  301.   {
  302.   	if(st == NULL) return NULL;
             ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:17: 
  300.   char *sk_value(const STACK *st, int i)
  301.   {
  302. > 	if(st == NULL) return NULL;
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(st == NULL) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   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.   
