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


crypto/pkcs7/pk7_doit.c:1037:1: start of procedure PKCS7_get_issuer_and_serial()
1035.   }
1036.   
1037. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1038.   {
1039.       STACK_OF(PKCS7_RECIP_INFO) *rsk;

crypto/pkcs7/pk7_doit.c:1043:5: 
1041.       int i;
1042.   
1043. >     i = OBJ_obj2nid(p7->type);
1044.       if (i != NID_pkcs7_signedAndEnveloped)
1045.           return NULL;

crypto/objects/obj_dat.c:395:1: start of procedure OBJ_obj2nid()
  393.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
  394.   
  395. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  396.   {
  397.       const unsigned int *op;

crypto/objects/obj_dat.c:400:9: Taking false branch
  398.       ADDED_OBJ ad, *adp;
  399.   
  400.       if (a == NULL)
                 ^
  401.           return (NID_undef);
  402.       if (a->nid != 0)

crypto/objects/obj_dat.c:402:9: Taking false branch
  400.       if (a == NULL)
  401.           return (NID_undef);
  402.       if (a->nid != 0)
                 ^
  403.           return (a->nid);
  404.   

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/pkcs7/pk7_doit.c:1044:9: Taking false branch
1042.   
1043.       i = OBJ_obj2nid(p7->type);
1044.       if (i != NID_pkcs7_signedAndEnveloped)
                ^
1045.           return NULL;
1046.       if (p7->d.signed_and_enveloped == NULL)

crypto/pkcs7/pk7_doit.c:1046:9: Taking false branch
1044.       if (i != NID_pkcs7_signedAndEnveloped)
1045.           return NULL;
1046.       if (p7->d.signed_and_enveloped == NULL)
                ^
1047.           return NULL;
1048.       rsk = p7->d.signed_and_enveloped->recipientinfo;

crypto/pkcs7/pk7_doit.c:1048:5: 
1046.       if (p7->d.signed_and_enveloped == NULL)
1047.           return NULL;
1048. >     rsk = p7->d.signed_and_enveloped->recipientinfo;
1049.       if (rsk == NULL)
1050.           return NULL;

crypto/pkcs7/pk7_doit.c:1049:9: Taking false branch
1047.           return NULL;
1048.       rsk = p7->d.signed_and_enveloped->recipientinfo;
1049.       if (rsk == NULL)
                ^
1050.           return NULL;
1051.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);

crypto/pkcs7/pk7_doit.c:1051:10: Condition is true
1049.       if (rsk == NULL)
1050.           return NULL;
1051.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
                 ^
1052.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1053.           return (NULL);

crypto/pkcs7/pk7_doit.c:1051:5: 
1049.       if (rsk == NULL)
1050.           return NULL;
1051. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1052.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1053.           return (NULL);

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

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

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

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

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

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

crypto/pkcs7/pk7_doit.c:1052:9: Condition is true
1050.           return NULL;
1051.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1052.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1053.           return (NULL);
1054.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

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

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

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

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

crypto/pkcs7/pk7_doit.c:1052:9: Taking false branch
1050.           return NULL;
1051.       ri = sk_PKCS7_RECIP_INFO_value(rsk, 0);
1052.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
                ^
1053.           return (NULL);
1054.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);

crypto/pkcs7/pk7_doit.c:1054:10: Condition is true
1052.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1053.           return (NULL);
1054.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
                 ^
1055.       return (ri->issuer_and_serial);
1056.   }

crypto/pkcs7/pk7_doit.c:1054:5: 
1052.       if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx)
1053.           return (NULL);
1054. >     ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1055.       return (ri->issuer_and_serial);
1056.   }

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

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

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

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

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

crypto/pkcs7/pk7_doit.c:1055:5: 
1053.           return (NULL);
1054.       ri = sk_PKCS7_RECIP_INFO_value(rsk, idx);
1055. >     return (ri->issuer_and_serial);
1056.   }
1057.   
