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


crypto/pkcs7/pk7_doit.c:1072:1: start of procedure PKCS7_get_issuer_and_serial()
1070.   }
1071.   
1072. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1073.   {
1074.       STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:1078:5: 
1076.       int i;
1077.   
1078. >     i = OBJ_obj2nid(p7->type);
1079.       if (i != NID_pkcs7_signedAndEnveloped)
1080.           return NULL;

crypto/objects/obj_dat.c:408:1: start of procedure OBJ_obj2nid()
  406.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
  407.   
  408. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  409.   {
  410.       const unsigned int *op;

crypto/objects/obj_dat.c:413:9: Taking false branch
  411.       ADDED_OBJ ad, *adp;
  412.   
  413.       if (a == NULL)
                 ^
  414.           return (NID_undef);
  415.       if (a->nid != 0)

crypto/objects/obj_dat.c:415:9: Taking false branch
  413.       if (a == NULL)
  414.           return (NID_undef);
  415.       if (a->nid != 0)
                 ^
  416.           return (a->nid);
  417.   

crypto/objects/obj_dat.c:418:9: Taking true branch
  416.           return (a->nid);
  417.   
  418.       if (added != NULL) {
                 ^
  419.           ad.type = ADDED_DATA;
  420.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */

crypto/objects/obj_dat.c:419:9: 
  417.   
  418.       if (added != NULL) {
  419. >         ad.type = ADDED_DATA;
  420.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  421.           adp = lh_ADDED_OBJ_retrieve(added, &ad);

crypto/objects/obj_dat.c:420:9: 
  418.       if (added != NULL) {
  419.           ad.type = ADDED_DATA;
  420. >         ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  421.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
  422.           if (adp != NULL)

crypto/objects/obj_dat.c:421:15: Condition is true
  419.           ad.type = ADDED_DATA;
  420.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  421.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
                       ^
  422.           if (adp != NULL)
  423.               return (adp->obj->nid);

crypto/objects/obj_dat.c:421:15: Condition is true
  419.           ad.type = ADDED_DATA;
  420.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  421.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
                       ^
  422.           if (adp != NULL)
  423.               return (adp->obj->nid);

crypto/objects/obj_dat.c:421:9: 
  419.           ad.type = ADDED_DATA;
  420.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  421. >         adp = lh_ADDED_OBJ_retrieve(added, &ad);
  422.           if (adp != NULL)
  423.               return (adp->obj->nid);

crypto/lhash/lhash.c:241:1: start of procedure lh_retrieve()
    239.   }
    240.   
    241. > void *lh_retrieve(_LHASH *lh, const void *data)
    242.   {
    243.       unsigned long hash;

crypto/lhash/lhash.c:247:5: 
    245.       void *ret;
    246.   
    247. >     lh->error = 0;
    248.       rn = getrn(lh, data, &hash);
    249.   

crypto/lhash/lhash.c:248:5: Skipping getrn(): empty list of specs
    246.   
    247.       lh->error = 0;
    248.       rn = getrn(lh, data, &hash);
               ^
    249.   
    250.       if (*rn == NULL) {

crypto/lhash/lhash.c:250:9: Taking false branch
    248.       rn = getrn(lh, data, &hash);
    249.   
    250.       if (*rn == NULL) {
                   ^
    251.           lh->num_retrieve_miss++;
    252.           return (NULL);

crypto/lhash/lhash.c:254:9: 
    252.           return (NULL);
    253.       } else {
    254. >         ret = (*rn)->data;
    255.           lh->num_retrieve++;
    256.       }

crypto/lhash/lhash.c:255:9: 
    253.       } else {
    254.           ret = (*rn)->data;
    255. >         lh->num_retrieve++;
    256.       }
    257.       return (ret);

crypto/lhash/lhash.c:257:5: 
    255.           lh->num_retrieve++;
    256.       }
    257. >     return (ret);
    258.   }
    259.   

crypto/lhash/lhash.c:258:1: return from a call to lh_retrieve
    256.       }
    257.       return (ret);
    258. > }
    259.   
    260.   static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_dat.c:422:13: Taking true branch
  420.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  421.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
  422.           if (adp != NULL)
                     ^
  423.               return (adp->obj->nid);
  424.       }

crypto/objects/obj_dat.c:423:13: 
  421.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
  422.           if (adp != NULL)
  423. >             return (adp->obj->nid);
  424.       }
  425.       op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);

crypto/objects/obj_dat.c:429:1: return from a call to OBJ_obj2nid
  427.           return (NID_undef);
  428.       return (nid_objs[*op].nid);
  429. > }
  430.   
  431.   /*

crypto/pkcs7/pk7_doit.c:1079:9: Taking false branch
1077.   
1078.       i = OBJ_obj2nid(p7->type);
1079.       if (i != NID_pkcs7_signedAndEnveloped)
                ^
1080.           return NULL;
1081.       if (p7->d.signed_and_enveloped == NULL)

crypto/pkcs7/pk7_doit.c:1081:9: Taking false branch
1079.       if (i != NID_pkcs7_signedAndEnveloped)
1080.           return NULL;
1081.       if (p7->d.signed_and_enveloped == NULL)
                ^
1082.           return NULL;
1083.       rsk = p7->d.signed_and_enveloped->recipientinfo;

crypto/pkcs7/pk7_doit.c:1083:5: 
1081.       if (p7->d.signed_and_enveloped == NULL)
1082.           return NULL;
1083. >     rsk = p7->d.signed_and_enveloped->recipientinfo;
1084.       if (rsk == NULL)
1085.           return NULL;

crypto/pkcs7/pk7_doit.c:1084:9: Taking false branch
1082.           return NULL;
1083.       rsk = p7->d.signed_and_enveloped->recipientinfo;
1084.       if (rsk == NULL)
                ^
1085.           return NULL;
1086.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);

crypto/pkcs7/pk7_doit.c:1086:10: Condition is true
1084.       if (rsk == NULL)
1085.           return NULL;
1086.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
                 ^
1087.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1088.           return (NULL);

crypto/pkcs7/pk7_doit.c:1086:5: 
1084.       if (rsk == NULL)
1085.           return NULL;
1086. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1087.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1088.           return (NULL);

crypto/stack/stack.c:347:1: start of procedure sk_value()
  345.   }
  346.   
  347. > void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:349:10: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                  ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:17: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                         ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:28: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:351:5: 
  349.       if (!st || (i < 0) || (i >= st->num))
  350.           return NULL;
  351. >     return st->data[i];
  352.   }
  353.   

crypto/stack/stack.c:352:1: return from a call to sk_value
  350.           return NULL;
  351.       return st->data[i];
  352. > }
  353.   
  354.   void *sk_set(_STACK *st, int i, void *value)

crypto/pkcs7/pk7_doit.c:1087:9: Condition is true
1085.           return NULL;
1086.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1087.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1088.           return (NULL);
1089.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/stack/stack.c:340:1: start of procedure sk_num()
  338.   }
  339.   
  340. > int sk_num(const _STACK *st)
  341.   {
  342.       if (st == NULL)

crypto/stack/stack.c:342:9: Taking false branch
  340.   int sk_num(const _STACK *st)
  341.   {
  342.       if (st == NULL)
                 ^
  343.           return -1;
  344.       return st->num;

crypto/stack/stack.c:344:5: 
  342.       if (st == NULL)
  343.           return -1;
  344. >     return st->num;
  345.   }
  346.   

crypto/stack/stack.c:345:1: return from a call to sk_num
  343.           return -1;
  344.       return st->num;
  345. > }
  346.   
  347.   void *sk_value(const _STACK *st, int i)

crypto/pkcs7/pk7_doit.c:1087:9: Taking false branch
1085.           return NULL;
1086.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1087.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1088.           return (NULL);
1089.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/pkcs7/pk7_doit.c:1089:10: Condition is true
1087.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1088.           return (NULL);
1089.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
                 ^
1090.       return (ri->issuer_and_serial);
1091.   }

crypto/pkcs7/pk7_doit.c:1089:5: 
1087.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1088.           return (NULL);
1089. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1090.       return (ri->issuer_and_serial);
1091.   }

crypto/stack/stack.c:347:1: start of procedure sk_value()
  345.   }
  346.   
  347. > void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:349:10: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                  ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:17: Taking true branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                         ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:350:9: 
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
  350. >         return NULL;
  351.       return st->data[i];
  352.   }

crypto/stack/stack.c:352:1: return from a call to sk_value
  350.           return NULL;
  351.       return st->data[i];
  352. > }
  353.   
  354.   void *sk_set(_STACK *st, int i, void *value)

crypto/pkcs7/pk7_doit.c:1090:5: 
1088.           return (NULL);
1089.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1090. >     return (ri->issuer_and_serial);
1091.   }
1092.   
