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


crypto/pkcs7/pk7_doit.c:763:1: start of procedure PKCS7_get_issuer_and_serial()
761.   	}
762.   
763. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
764.   	{
765.   	STACK *rsk;

crypto/pkcs7/pk7_doit.c:769:2: 
767.   	int i;
768.   
769. > 	i=OBJ_obj2nid(p7->type);
770.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
771.   	rsk=p7->d.signed_and_enveloped->recipientinfo;

crypto/objects/obj_dat.c:354:1: start of procedure OBJ_obj2nid()
  352.   	}
  353.   
  354. > int OBJ_obj2nid(ASN1_OBJECT *a)
  355.   	{
  356.   	ASN1_OBJECT **op;

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

crypto/objects/obj_dat.c:361:6: Taking true branch
  359.   	if (a == NULL)
  360.   		return(NID_undef);
  361.   	if (a->nid != 0)
              ^
  362.   		return(a->nid);
  363.   

crypto/objects/obj_dat.c:362:3: 
  360.   		return(NID_undef);
  361.   	if (a->nid != 0)
  362. > 		return(a->nid);
  363.   
  364.   	if (added != NULL)

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

crypto/pkcs7/pk7_doit.c:770:6: Taking false branch
768.   
769.   	i=OBJ_obj2nid(p7->type);
770.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
            ^
771.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
772.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,0);

crypto/pkcs7/pk7_doit.c:771:2: 
769.   	i=OBJ_obj2nid(p7->type);
770.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
771. > 	rsk=p7->d.signed_and_enveloped->recipientinfo;
772.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,0);
773.   	if (sk_num(rsk) <= idx) return(NULL);

crypto/pkcs7/pk7_doit.c:772:2: 
770.   	if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
771.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
772. > 	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,0);
773.   	if (sk_num(rsk) <= idx) return(NULL);
774.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,idx);

crypto/stack/stack.c:293:1: start of procedure sk_value()
  291.   }
  292.   
  293. > char *sk_value(STACK *st, int i)
  294.   {
  295.   	if(st == NULL) return NULL;

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

crypto/stack/stack.c:295:17: 
  293.   char *sk_value(STACK *st, int i)
  294.   {
  295. > 	if(st == NULL) return NULL;
  296.   	return st->data[i];
  297.   }

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

crypto/pkcs7/pk7_doit.c:773:6: 
771.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
772.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,0);
773. > 	if (sk_num(rsk) <= idx) return(NULL);
774.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,idx);
775.   	return(ri->issuer_and_serial);

crypto/stack/stack.c:287:1: start of procedure sk_num()
  285.   	}
  286.   
  287. > int sk_num(STACK *st)
  288.   {
  289.   	if(st == NULL) return -1;

crypto/stack/stack.c:289:5: Taking true branch
  287.   int sk_num(STACK *st)
  288.   {
  289.   	if(st == NULL) return -1;
             ^
  290.   	return st->num;
  291.   }

crypto/stack/stack.c:289:17: 
  287.   int sk_num(STACK *st)
  288.   {
  289. > 	if(st == NULL) return -1;
  290.   	return st->num;
  291.   }

crypto/stack/stack.c:291:1: return from a call to sk_num
  289.   	if(st == NULL) return -1;
  290.   	return st->num;
  291. > }
  292.   
  293.   char *sk_value(STACK *st, int i)

crypto/pkcs7/pk7_doit.c:773:6: Taking false branch
771.   	rsk=p7->d.signed_and_enveloped->recipientinfo;
772.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,0);
773.   	if (sk_num(rsk) <= idx) return(NULL);
            ^
774.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,idx);
775.   	return(ri->issuer_and_serial);

crypto/pkcs7/pk7_doit.c:774:2: 
772.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,0);
773.   	if (sk_num(rsk) <= idx) return(NULL);
774. > 	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,idx);
775.   	return(ri->issuer_and_serial);
776.   	}

crypto/stack/stack.c:293:1: start of procedure sk_value()
  291.   }
  292.   
  293. > char *sk_value(STACK *st, int i)
  294.   {
  295.   	if(st == NULL) return NULL;

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

crypto/stack/stack.c:295:17: 
  293.   char *sk_value(STACK *st, int i)
  294.   {
  295. > 	if(st == NULL) return NULL;
  296.   	return st->data[i];
  297.   }

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

crypto/pkcs7/pk7_doit.c:775:2: 
773.   	if (sk_num(rsk) <= idx) return(NULL);
774.   	ri=(PKCS7_RECIP_INFO *)sk_value(rsk,idx);
775. > 	return(ri->issuer_and_serial);
776.   	}
777.   
