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


crypto/pkcs7/pk7_doit.c:1078:1: start of procedure PKCS7_get_issuer_and_serial()
1076.   }
1077.   
1078. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1079.   {
1080.       STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:1084:5: 
1082.       int i;
1083.   
1084. >     i = OBJ_obj2nid(p7->type);
1085.       if (i != NID_pkcs7_signedAndEnveloped)
1086.           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:237:1: start of procedure lh_retrieve()
    235.   }
    236.   
    237. > void *lh_retrieve(_LHASH *lh, const void *data)
    238.   {
    239.       unsigned long hash;

crypto/lhash/lhash.c:243:5: 
    241.       void *ret;
    242.   
    243. >     lh->error = 0;
    244.       rn = getrn(lh, data, &hash);
    245.   

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

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

crypto/lhash/lhash.c:250:9: 
    248.           return (NULL);
    249.       } else {
    250. >         ret = (*rn)->data;
    251.           lh->num_retrieve++;
    252.       }

crypto/lhash/lhash.c:251:9: 
    249.       } else {
    250.           ret = (*rn)->data;
    251. >         lh->num_retrieve++;
    252.       }
    253.       return (ret);

crypto/lhash/lhash.c:253:5: 
    251.           lh->num_retrieve++;
    252.       }
    253. >     return (ret);
    254.   }
    255.   

crypto/lhash/lhash.c:254:1: return from a call to lh_retrieve
    252.       }
    253.       return (ret);
    254. > }
    255.   
    256.   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:1085:9: Taking false branch
1083.   
1084.       i = OBJ_obj2nid(p7->type);
1085.       if (i != NID_pkcs7_signedAndEnveloped)
                ^
1086.           return NULL;
1087.       if (p7->d.signed_and_enveloped == NULL)

crypto/pkcs7/pk7_doit.c:1087:9: Taking false branch
1085.       if (i != NID_pkcs7_signedAndEnveloped)
1086.           return NULL;
1087.       if (p7->d.signed_and_enveloped == NULL)
                ^
1088.           return NULL;
1089.       rsk = p7->d.signed_and_enveloped->recipientinfo;

crypto/pkcs7/pk7_doit.c:1089:5: 
1087.       if (p7->d.signed_and_enveloped == NULL)
1088.           return NULL;
1089. >     rsk = p7->d.signed_and_enveloped->recipientinfo;
1090.       if (rsk == NULL)
1091.           return NULL;

crypto/pkcs7/pk7_doit.c:1090:9: Taking false branch
1088.           return NULL;
1089.       rsk = p7->d.signed_and_enveloped->recipientinfo;
1090.       if (rsk == NULL)
                ^
1091.           return NULL;
1092.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);

crypto/pkcs7/pk7_doit.c:1092:10: Condition is true
1090.       if (rsk == NULL)
1091.           return NULL;
1092.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
                 ^
1093.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1094.           return (NULL);

crypto/pkcs7/pk7_doit.c:1092:5: 
1090.       if (rsk == NULL)
1091.           return NULL;
1092. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1093.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1094.           return (NULL);

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

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

crypto/stack/stack.c:330:17: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                         ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:330:28: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:332:5: 
  330.       if (!st || (i < 0) || (i >= st->num))
  331.           return NULL;
  332. >     return st->data[i];
  333.   }
  334.   

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

crypto/pkcs7/pk7_doit.c:1093:9: Condition is true
1091.           return NULL;
1092.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1093.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1094.           return (NULL);
1095.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/stack/stack.c:321:1: start of procedure sk_num()
  319.   }
  320.   
  321. > int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)

crypto/stack/stack.c:323:9: Taking false branch
  321.   int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)
                 ^
  324.           return -1;
  325.       return st->num;

crypto/stack/stack.c:325:5: 
  323.       if (st == NULL)
  324.           return -1;
  325. >     return st->num;
  326.   }
  327.   

crypto/stack/stack.c:326:1: return from a call to sk_num
  324.           return -1;
  325.       return st->num;
  326. > }
  327.   
  328.   void *sk_value(const _STACK *st, int i)

crypto/pkcs7/pk7_doit.c:1093:9: Taking false branch
1091.           return NULL;
1092.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1093.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1094.           return (NULL);
1095.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/pkcs7/pk7_doit.c:1095:10: Condition is true
1093.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1094.           return (NULL);
1095.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
                 ^
1096.       return (ri->issuer_and_serial);
1097.   }

crypto/pkcs7/pk7_doit.c:1095:5: 
1093.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1094.           return (NULL);
1095. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1096.       return (ri->issuer_and_serial);
1097.   }

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

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

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

crypto/stack/stack.c:331:9: 
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
  331. >         return NULL;
  332.       return st->data[i];
  333.   }

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

crypto/pkcs7/pk7_doit.c:1096:5: 
1094.           return (NULL);
1095.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1096. >     return (ri->issuer_and_serial);
1097.   }
1098.   
