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


crypto/pkcs7/pk7_doit.c:1092:1: start of procedure PKCS7_get_issuer_and_serial()
1090.   }
1091.   
1092. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1093.   {
1094.       STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:1098:5: 
1096.       int i;
1097.   
1098. >     i = OBJ_obj2nid(p7->type);
1099.       if (i != NID_pkcs7_signedAndEnveloped)
1100.           return NULL;

crypto/objects/obj_dat.c:390:1: start of procedure OBJ_obj2nid()
  388.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
  389.   
  390. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  391.   {
  392.       const unsigned int *op;

crypto/objects/obj_dat.c:395:9: Taking false branch
  393.       ADDED_OBJ ad, *adp;
  394.   
  395.       if (a == NULL)
                 ^
  396.           return (NID_undef);
  397.       if (a->nid != 0)

crypto/objects/obj_dat.c:397:9: Taking false branch
  395.       if (a == NULL)
  396.           return (NID_undef);
  397.       if (a->nid != 0)
                 ^
  398.           return (a->nid);
  399.   

crypto/objects/obj_dat.c:400:9: Taking false branch
  398.           return (a->nid);
  399.   
  400.       if (a->length == 0)
                 ^
  401.           return NID_undef;
  402.   

crypto/objects/obj_dat.c:403:9: Taking true branch
  401.           return NID_undef;
  402.   
  403.       if (added != NULL) {
                 ^
  404.           ad.type = ADDED_DATA;
  405.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */

crypto/objects/obj_dat.c:404:9: 
  402.   
  403.       if (added != NULL) {
  404. >         ad.type = ADDED_DATA;
  405.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  406.           adp = lh_ADDED_OBJ_retrieve(added, &ad);

crypto/objects/obj_dat.c:405:9: 
  403.       if (added != NULL) {
  404.           ad.type = ADDED_DATA;
  405. >         ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  406.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
  407.           if (adp != NULL)

crypto/objects/obj_dat.c:406:15: Condition is true
  404.           ad.type = ADDED_DATA;
  405.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  406.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
                       ^
  407.           if (adp != NULL)
  408.               return (adp->obj->nid);

crypto/objects/obj_dat.c:406:15: Condition is true
  404.           ad.type = ADDED_DATA;
  405.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  406.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
                       ^
  407.           if (adp != NULL)
  408.               return (adp->obj->nid);

crypto/objects/obj_dat.c:406:9: 
  404.           ad.type = ADDED_DATA;
  405.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  406. >         adp = lh_ADDED_OBJ_retrieve(added, &ad);
  407.           if (adp != NULL)
  408.               return (adp->obj->nid);

crypto/lhash/lhash.c:217:1: start of procedure lh_retrieve()
    215.   }
    216.   
    217. > void *lh_retrieve(_LHASH *lh, const void *data)
    218.   {
    219.       unsigned long hash;

crypto/lhash/lhash.c:223:5: 
    221.       void *ret;
    222.   
    223. >     lh->error = 0;
    224.       rn = getrn(lh, data, &hash);
    225.   

crypto/lhash/lhash.c:224:5: Skipping getrn(): empty list of specs
    222.   
    223.       lh->error = 0;
    224.       rn = getrn(lh, data, &hash);
               ^
    225.   
    226.       if (*rn == NULL) {

crypto/lhash/lhash.c:226:9: Taking false branch
    224.       rn = getrn(lh, data, &hash);
    225.   
    226.       if (*rn == NULL) {
                   ^
    227.           lh->num_retrieve_miss++;
    228.           return (NULL);

crypto/lhash/lhash.c:230:9: 
    228.           return (NULL);
    229.       } else {
    230. >         ret = (*rn)->data;
    231.           lh->num_retrieve++;
    232.       }

crypto/lhash/lhash.c:231:9: 
    229.       } else {
    230.           ret = (*rn)->data;
    231. >         lh->num_retrieve++;
    232.       }
    233.       return (ret);

crypto/lhash/lhash.c:233:5: 
    231.           lh->num_retrieve++;
    232.       }
    233. >     return (ret);
    234.   }
    235.   

crypto/lhash/lhash.c:234:1: return from a call to lh_retrieve
    232.       }
    233.       return (ret);
    234. > }
    235.   
    236.   static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_dat.c:407:13: Taking true branch
  405.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  406.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
  407.           if (adp != NULL)
                     ^
  408.               return (adp->obj->nid);
  409.       }

crypto/objects/obj_dat.c:408:13: 
  406.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
  407.           if (adp != NULL)
  408. >             return (adp->obj->nid);
  409.       }
  410.       op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);

crypto/objects/obj_dat.c:414:1: return from a call to OBJ_obj2nid
  412.           return (NID_undef);
  413.       return (nid_objs[*op].nid);
  414. > }
  415.   
  416.   /*

crypto/pkcs7/pk7_doit.c:1099:9: Taking false branch
1097.   
1098.       i = OBJ_obj2nid(p7->type);
1099.       if (i != NID_pkcs7_signedAndEnveloped)
                ^
1100.           return NULL;
1101.       if (p7->d.signed_and_enveloped == NULL)

crypto/pkcs7/pk7_doit.c:1101:9: Taking false branch
1099.       if (i != NID_pkcs7_signedAndEnveloped)
1100.           return NULL;
1101.       if (p7->d.signed_and_enveloped == NULL)
                ^
1102.           return NULL;
1103.       rsk = p7->d.signed_and_enveloped->recipientinfo;

crypto/pkcs7/pk7_doit.c:1103:5: 
1101.       if (p7->d.signed_and_enveloped == NULL)
1102.           return NULL;
1103. >     rsk = p7->d.signed_and_enveloped->recipientinfo;
1104.       if (rsk == NULL)
1105.           return NULL;

crypto/pkcs7/pk7_doit.c:1104:9: Taking false branch
1102.           return NULL;
1103.       rsk = p7->d.signed_and_enveloped->recipientinfo;
1104.       if (rsk == NULL)
                ^
1105.           return NULL;
1106.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)

crypto/pkcs7/pk7_doit.c:1106:9: Condition is true
1104.       if (rsk == NULL)
1105.           return NULL;
1106.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1107.           return (NULL);
1108.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/stack/stack.c:317:1: start of procedure sk_num()
  315.   }
  316.   
  317. > int sk_num(const _STACK *st)
  318.   {
  319.       if (st == NULL)

crypto/stack/stack.c:319:9: Taking false branch
  317.   int sk_num(const _STACK *st)
  318.   {
  319.       if (st == NULL)
                 ^
  320.           return -1;
  321.       return st->num;

crypto/stack/stack.c:321:5: 
  319.       if (st == NULL)
  320.           return -1;
  321. >     return st->num;
  322.   }
  323.   

crypto/stack/stack.c:322:1: return from a call to sk_num
  320.           return -1;
  321.       return st->num;
  322. > }
  323.   
  324.   void *sk_value(const _STACK *st, int i)

crypto/pkcs7/pk7_doit.c:1106:9: Taking false branch
1104.       if (rsk == NULL)
1105.           return NULL;
1106.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1107.           return (NULL);
1108.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/pkcs7/pk7_doit.c:1108:10: Condition is true
1106.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1107.           return (NULL);
1108.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
                 ^
1109.       return (ri->issuer_and_serial);
1110.   }

crypto/pkcs7/pk7_doit.c:1108:5: 
1106.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1107.           return (NULL);
1108. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1109.       return (ri->issuer_and_serial);
1110.   }

crypto/stack/stack.c:324:1: start of procedure sk_value()
  322.   }
  323.   
  324. > void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:326:10: Taking false branch
  324.   void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
                  ^
  327.           return NULL;
  328.       return st->data[i];

crypto/stack/stack.c:326:17: Taking true branch
  324.   void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
                         ^
  327.           return NULL;
  328.       return st->data[i];

crypto/stack/stack.c:327:9: 
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
  327. >         return NULL;
  328.       return st->data[i];
  329.   }

crypto/stack/stack.c:329:1: return from a call to sk_value
  327.           return NULL;
  328.       return st->data[i];
  329. > }
  330.   
  331.   void *sk_set(_STACK *st, int i, void *value)

crypto/pkcs7/pk7_doit.c:1109:5: 
1107.           return (NULL);
1108.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1109. >     return (ri->issuer_and_serial);
1110.   }
1111.   
