crypto/evp/evp_fetch.c:156: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `ossl_method_store_add`.
Showing all 10 steps of the trace


crypto/evp/evp_fetch.c:156:12: Call
154.           return 0;
155.   
156.       return ossl_method_store_add(store, prov, meth_id, propdef, method,
                  ^
157.                                    methdata->refcnt_up_method,
158.                                    methdata->destruct_method);

crypto/property/property.c:166:1: Parameter `store->algs->nelem`
  164.   }
  165.   
  166. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
  167.                             int nid, const char *properties, void *method,
  168.                             int (*method_up_ref)(void *),

crypto/property/property.c:215:14: Call
  213.               goto err;
  214.           alg->nid = nid;
  215.           if (!ossl_method_store_insert(store, alg))
                      ^
  216.               goto err;
  217.       }

crypto/property/property.c:161:1: Parameter `store->algs->nelem`
    159.   }
    160.   
    161. > static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg)
    162.   {
    163.           return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg);

crypto/property/property.c:163:16: Call
    161.   static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg)
    162.   {
    163.           return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg);
                          ^
    164.   }
    165.   

crypto/property/property.c:67:1: Parameter `sa->nelem`
      65.   } IMPL_CACHE_FLUSH;
      66.   
      67. > DEFINE_SPARSE_ARRAY_OF(ALGORITHM);
      68.   
      69.   static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid);

crypto/property/property.c:67:1: Call
      65.   } IMPL_CACHE_FLUSH;
      66.   
      67. > DEFINE_SPARSE_ARRAY_OF(ALGORITHM);
      68.   
      69.   static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid);

crypto/sparse_array.c:183:1: <LHS trace>
181.   }
182.   
183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val)
184.   {
185.       int i, level = 1;

crypto/sparse_array.c:183:1: Parameter `sa->nelem`
        181.   }
        182.   
        183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val)
        184.   {
        185.       int i, level = 1;

crypto/sparse_array.c:215:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ossl_method_store_add` 
        213.       p += posn & SA_BLOCK_MASK;
        214.       if (val == NULL && *p != NULL)
        215.           sa->nelem--;
                       ^
        216.       else if (val != NULL && *p == NULL)
        217.           sa->nelem++;

int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val)
{
    int i, level = 1;
    ossl_uintmax_t n = posn;
    void **p;
    if (sa == NULL)
        return 0;
    for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++)
        if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0)
            break;
    for (;sa->levels < level; sa->levels++) {
        p = alloc_node();
        if (p == NULL)
            return 0;
        p[0] = sa->nodes;
        sa->nodes = p;
    }
    if (sa->top < posn)
        sa->top = posn;
    p = sa->nodes;
    for (level = sa->levels - 1; level > 0; level--) {
        i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK;
        if (p[i] == NULL && (p[i] = alloc_node()) == NULL)
            return 0;
        p = p[i];
    }
    p += posn & SA_BLOCK_MASK;
    if (val == NULL && *p != NULL)
        sa->nelem--;
    else if (val != NULL && *p == NULL)
        sa->nelem++;
    *p = val;
    return 1;
}
['static int put_method_in_store(OPENSSL_CTX *libctx, void *store,\n                               void *method, const OSSL_PROVIDER *prov,\n                               int operation_id, const char *name,\n                               const char *propdef, void *data)\n{\n    struct method_data_st *methdata = data;\n    OSSL_NAMEMAP *namemap;\n    int name_id;\n    uint32_t meth_id;\n    if ((namemap = ossl_namemap_stored(libctx)) == NULL\n        || (name_id = ossl_namemap_name2num(namemap, name)) == 0\n        || (meth_id = method_id(operation_id, name_id)) == 0)\n        return 0;\n    if (store == NULL\n        && (store = get_default_method_store(libctx)) == NULL)\n        return 0;\n    return ossl_method_store_add(store, prov, meth_id, propdef, method,\n                                 methdata->refcnt_up_method,\n                                 methdata->destruct_method);\n}', 'int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,\n                          int nid, const char *properties, void *method,\n                          int (*method_up_ref)(void *),\n                          void (*method_destruct)(void *))\n{\n    ALGORITHM *alg = NULL;\n    IMPLEMENTATION *impl;\n    int ret = 0;\n    int i;\n    if (nid <= 0 || method == NULL || store == NULL)\n        return 0;\n    if (properties == NULL)\n        properties = "";\n    impl = OPENSSL_malloc(sizeof(*impl));\n    if (impl == NULL)\n        return 0;\n    if (method_up_ref != NULL && !method_up_ref(method)) {\n        OPENSSL_free(impl);\n        return 0;\n    }\n    impl->provider = prov;\n    impl->method = method;\n    impl->method_destruct = method_destruct;\n    ossl_property_write_lock(store);\n    ossl_method_cache_flush(store, nid);\n    if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {\n        impl->properties = ossl_parse_property(store->ctx, properties);\n        if (impl->properties == NULL)\n            goto err;\n        ossl_prop_defn_set(store->ctx, properties, impl->properties);\n    }\n    alg = ossl_method_store_retrieve(store, nid);\n    if (alg == NULL) {\n        if ((alg = OPENSSL_zalloc(sizeof(*alg))) == NULL\n                || (alg->impls = sk_IMPLEMENTATION_new_null()) == NULL\n                || (alg->cache = lh_QUERY_new(&query_hash, &query_cmp)) == NULL)\n            goto err;\n        alg->nid = nid;\n        if (!ossl_method_store_insert(store, alg))\n            goto err;\n    }\n    for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) {\n        const IMPLEMENTATION *tmpimpl = sk_IMPLEMENTATION_value(alg->impls, i);\n        if (tmpimpl->provider == impl->provider\n            && tmpimpl->properties == impl->properties)\n            break;\n    }\n    if (i == sk_IMPLEMENTATION_num(alg->impls)\n        && sk_IMPLEMENTATION_push(alg->impls, impl))\n        ret = 1;\n    ossl_property_unlock(store);\n    if (ret == 0)\n        impl_free(impl);\n    return ret;\nerr:\n    ossl_property_unlock(store);\n    alg_cleanup(0, alg);\n    impl_free(impl);\n    return 0;\n}', 'static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg)\n{\n        return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg);\n}', 'DEFINE_SPARSE_ARRAY_OF(ALGORITHM)', 'int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val)\n{\n    int i, level = 1;\n    ossl_uintmax_t n = posn;\n    void **p;\n    if (sa == NULL)\n        return 0;\n    for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++)\n        if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0)\n            break;\n    for (;sa->levels < level; sa->levels++) {\n        p = alloc_node();\n        if (p == NULL)\n            return 0;\n        p[0] = sa->nodes;\n        sa->nodes = p;\n    }\n    if (sa->top < posn)\n        sa->top = posn;\n    p = sa->nodes;\n    for (level = sa->levels - 1; level > 0; level--) {\n        i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK;\n        if (p[i] == NULL && (p[i] = alloc_node()) == NULL)\n            return 0;\n        p = p[i];\n    }\n    p += posn & SA_BLOCK_MASK;\n    if (val == NULL && *p != NULL)\n        sa->nelem--;\n    else if (val != NULL && *p == NULL)\n        sa->nelem++;\n    *p = val;\n    return 1;\n}']