crypto/objects/obj_xref.c:140: error: NULL_DEREFERENCE
  pointer `*rv` last assigned on line 128 could be null and is dereferenced at line 140, column 20.
Showing all 38 steps of the trace


crypto/objects/obj_xref.c:116:1: start of procedure OBJ_find_sigid_by_algs()
114.   }
115.   
116. > int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)
117.   {
118.       nid_triple tmp;

crypto/objects/obj_xref.c:119:5: 
117.   {
118.       nid_triple tmp;
119. >     const nid_triple *t = &tmp;
120.       const nid_triple **rv = NULL;
121.   

crypto/objects/obj_xref.c:120:5: 
118.       nid_triple tmp;
119.       const nid_triple *t = &tmp;
120. >     const nid_triple **rv = NULL;
121.   
122.       tmp.hash_id = dig_nid;

crypto/objects/obj_xref.c:122:5: 
120.       const nid_triple **rv = NULL;
121.   
122. >     tmp.hash_id = dig_nid;
123.       tmp.pkey_id = pkey_nid;
124.   

crypto/objects/obj_xref.c:123:5: 
121.   
122.       tmp.hash_id = dig_nid;
123. >     tmp.pkey_id = pkey_nid;
124.   
125.       if (sigx_app) {

crypto/objects/obj_xref.c:125:9: Taking true branch
123.       tmp.pkey_id = pkey_nid;
124.   
125.       if (sigx_app) {
               ^
126.           int idx = sk_nid_triple_find(sigx_app, &tmp);
127.           if (idx >= 0) {

crypto/objects/obj_xref.c:126:9: 
124.   
125.       if (sigx_app) {
126. >         int idx = sk_nid_triple_find(sigx_app, &tmp);
127.           if (idx >= 0) {
128.               t = sk_nid_triple_value(sigx_app, idx);

crypto/objects/obj_xref.h:9:1: start of procedure sk_nid_triple_find()
  7.   } nid_triple;
  8.   
  9. > DEFINE_STACK_OF(nid_triple)
  10.   
  11.   static const nid_triple sigoid_srt[] = {

crypto/stack/stack.c:248:1: start of procedure sk_find()
    246.   }
    247.   
    248. > int sk_find(_STACK *st, void *data)
    249.   {
    250.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:250:5: 
    248.   int sk_find(_STACK *st, void *data)
    249.   {
    250. >     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    251.   }
    252.   

crypto/stack/stack.c:224:1: start of procedure internal_find()
      222.   }
      223.   
      224. > static int internal_find(_STACK *st, void *data, int ret_val_options)
      225.   {
      226.       const void *const *r;

crypto/stack/stack.c:229:9: Taking false branch
      227.       int i;
      228.   
      229.       if (st == NULL)
                     ^
      230.           return -1;
      231.   

crypto/stack/stack.c:232:9: Taking true branch
      230.           return -1;
      231.   
      232.       if (st->comp == NULL) {
                     ^
      233.           for (i = 0; i < st->num; i++)
      234.               if (st->data[i] == data)

crypto/stack/stack.c:233:14: 
      231.   
      232.       if (st->comp == NULL) {
      233. >         for (i = 0; i < st->num; i++)
      234.               if (st->data[i] == data)
      235.                   return (i);

crypto/stack/stack.c:233:21: Loop condition is true. Entering loop body
      231.   
      232.       if (st->comp == NULL) {
      233.           for (i = 0; i < st->num; i++)
                                 ^
      234.               if (st->data[i] == data)
      235.                   return (i);

crypto/stack/stack.c:234:17: Taking false branch
      232.       if (st->comp == NULL) {
      233.           for (i = 0; i < st->num; i++)
      234.               if (st->data[i] == data)
                             ^
      235.                   return (i);
      236.           return (-1);

crypto/stack/stack.c:233:34: 
      231.   
      232.       if (st->comp == NULL) {
      233. >         for (i = 0; i < st->num; i++)
      234.               if (st->data[i] == data)
      235.                   return (i);

crypto/stack/stack.c:233:21: Loop condition is true. Entering loop body
      231.   
      232.       if (st->comp == NULL) {
      233.           for (i = 0; i < st->num; i++)
                                 ^
      234.               if (st->data[i] == data)
      235.                   return (i);

crypto/stack/stack.c:234:17: Taking true branch
      232.       if (st->comp == NULL) {
      233.           for (i = 0; i < st->num; i++)
      234.               if (st->data[i] == data)
                             ^
      235.                   return (i);
      236.           return (-1);

crypto/stack/stack.c:235:17: 
      233.           for (i = 0; i < st->num; i++)
      234.               if (st->data[i] == data)
      235. >                 return (i);
      236.           return (-1);
      237.       }

crypto/stack/stack.c:246:1: return from a call to internal_find
      244.           return (-1);
      245.       return (int)((char **)r - st->data);
      246. > }
      247.   
      248.   int sk_find(_STACK *st, void *data)

crypto/stack/stack.c:251:1: return from a call to sk_find
    249.   {
    250.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    251. > }
    252.   
    253.   int sk_find_ex(_STACK *st, void *data)

crypto/objects/obj_xref.h:9:1: return from a call to sk_nid_triple_find
  7.   } nid_triple;
  8.   
  9. > DEFINE_STACK_OF(nid_triple)
  10.   
  11.   static const nid_triple sigoid_srt[] = {

crypto/objects/obj_xref.c:127:13: Taking true branch
125.       if (sigx_app) {
126.           int idx = sk_nid_triple_find(sigx_app, &tmp);
127.           if (idx >= 0) {
                   ^
128.               t = sk_nid_triple_value(sigx_app, idx);
129.               rv = &t;

crypto/objects/obj_xref.c:128:13: 
126.           int idx = sk_nid_triple_find(sigx_app, &tmp);
127.           if (idx >= 0) {
128. >             t = sk_nid_triple_value(sigx_app, idx);
129.               rv = &t;
130.           }

crypto/objects/obj_xref.h:9:1: start of procedure sk_nid_triple_value()
  7.   } nid_triple;
  8.   
  9. > DEFINE_STACK_OF(nid_triple)
  10.   
  11.   static const nid_triple sigoid_srt[] = {

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

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

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

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

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

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

crypto/objects/obj_xref.h:9:1: return from a call to sk_nid_triple_value
  7.   } nid_triple;
  8.   
  9. > DEFINE_STACK_OF(nid_triple)
  10.   
  11.   static const nid_triple sigoid_srt[] = {

crypto/objects/obj_xref.c:129:13: 
127.           if (idx >= 0) {
128.               t = sk_nid_triple_value(sigx_app, idx);
129. >             rv = &t;
130.           }
131.       }

crypto/objects/obj_xref.c:133:9: Taking false branch
131.       }
132.   #ifndef OBJ_XREF_TEST2
133.       if (rv == NULL) {
               ^
134.           rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, OSSL_NELEM(sigoid_srt_xref));
135.       }

crypto/objects/obj_xref.c:137:9: Taking false branch
135.       }
136.   #endif
137.       if (rv == NULL)
               ^
138.           return 0;
139.       if (psignid)

crypto/objects/obj_xref.c:139:9: Taking true branch
137.       if (rv == NULL)
138.           return 0;
139.       if (psignid)
               ^
140.           *psignid = (*rv)->sign_id;
141.       return 1;

crypto/objects/obj_xref.c:140:9: 
138.           return 0;
139.       if (psignid)
140. >         *psignid = (*rv)->sign_id;
141.       return 1;
142.   }

int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)
{
    nid_triple tmp;
    const nid_triple *t = &tmp;
    const nid_triple **rv = NULL;
    tmp.hash_id = dig_nid;
    tmp.pkey_id = pkey_nid;
    if (sigx_app) {
        int idx = sk_nid_triple_find(sigx_app, &tmp);
        if (idx >= 0) {
            t = sk_nid_triple_value(sigx_app, idx);
            rv = &t;
        }
    }
#ifndef OBJ_XREF_TEST2
    if (rv == NULL) {
        rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, OSSL_NELEM(sigoid_srt_xref));
    }
#endif
    if (rv == NULL)
        return 0;
    if (psignid)
        *psignid = (*rv)->sign_id;
    return 1;
}
['int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)\n{\n    nid_triple tmp;\n    const nid_triple *t = &tmp;\n    const nid_triple **rv = NULL;\n    tmp.hash_id = dig_nid;\n    tmp.pkey_id = pkey_nid;\n    if (sigx_app) {\n        int idx = sk_nid_triple_find(sigx_app, &tmp);\n        if (idx >= 0) {\n            t = sk_nid_triple_value(sigx_app, idx);\n            rv = &t;\n        }\n    }\n#ifndef OBJ_XREF_TEST2\n    if (rv == NULL) {\n        rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, OSSL_NELEM(sigoid_srt_xref));\n    }\n#endif\n    if (rv == NULL)\n        return 0;\n    if (psignid)\n        *psignid = (*rv)->sign_id;\n    return 1;\n}', 'DEFINE_STACK_OF(nid_triple)', 'int sk_find(_STACK *st, void *data)\n{\n    return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);\n}', 'static int internal_find(_STACK *st, void *data, int ret_val_options)\n{\n    const void *const *r;\n    int i;\n    if (st == NULL)\n        return -1;\n    if (st->comp == NULL) {\n        for (i = 0; i < st->num; i++)\n            if (st->data[i] == data)\n                return (i);\n        return (-1);\n    }\n    sk_sort(st);\n    if (data == NULL)\n        return (-1);\n    r = OBJ_bsearch_ex_(&data, st->data, st->num, sizeof(void *), st->comp,\n                        ret_val_options);\n    if (r == NULL)\n        return (-1);\n    return (int)((char **)r - st->data);\n}', 'void *sk_value(const _STACK *st, int i)\n{\n    if (!st || (i < 0) || (i >= st->num))\n        return NULL;\n    return st->data[i];\n}']