crypto/store/store_register.c:177: error: BUFFER_OVERRUN_L3
  Offset: [16, +oo] Size: [1, +oo] by call to `lh_OSSL_STORE_LOADER_insert`.
Showing all 17 steps of the trace


crypto/store/store_register.c:172:27: Call
170.   
171.       if (loader_register == NULL) {
172.           loader_register = lh_OSSL_STORE_LOADER_new(store_loader_hash,
                                 ^
173.                                                      store_loader_cmp);
174.       }

crypto/store/store_locl.h:83:1: Call
  81.       OSSL_STORE_close_fn close;
  82.   };
  83. > DEFINE_LHASH_OF(OSSL_STORE_LOADER);
  84.   
  85.   const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme);

crypto/lhash/lhash.c:38:5: Assignment
    36.       ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
    37.       ret->num_nodes = MIN_NODES / 2;
    38.       ret->num_alloc_nodes = MIN_NODES;
              ^
    39.       ret->pmax = MIN_NODES / 2;
    40.       ret->up_load = UP_LOAD;

crypto/store/store_register.c:177:13: Call
175.   
176.       if (loader_register != NULL
177.           && (lh_OSSL_STORE_LOADER_insert(loader_register, loader) != NULL
                   ^
178.               || lh_OSSL_STORE_LOADER_error(loader_register) == 0))
179.           ok = 1;

crypto/store/store_locl.h:83:1: Parameter `lh->num_alloc_nodes`
  81.       OSSL_STORE_close_fn close;
  82.   };
  83. > DEFINE_LHASH_OF(OSSL_STORE_LOADER);
  84.   
  85.   const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme);

crypto/store/store_locl.h:83:1: Call
  81.       OSSL_STORE_close_fn close;
  82.   };
  83. > DEFINE_LHASH_OF(OSSL_STORE_LOADER);
  84.   
  85.   const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme);

crypto/lhash/lhash.c:70:1: Parameter `lh->num_alloc_nodes`
    68.   }
    69.   
    70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
    71.   {
    72.       unsigned long hash;

crypto/lhash/lhash.c:77:77: Call
    75.   
    76.       lh->error = 0;
    77.       if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
                                                                                      ^
    78.           return NULL;        /* 'lh->error++' already done in 'expand' */
    79.   

crypto/lhash/lhash.c:186:1: <Offset trace>
184.   }
185.   
186. > static int expand(OPENSSL_LHASH *lh)
187.   {
188.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:186:1: Parameter `lh->num_alloc_nodes`
      184.   }
      185.   
      186. > static int expand(OPENSSL_LHASH *lh)
      187.   {
      188.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:212:9: Assignment
      210.   
      211.       if ((lh->p) >= lh->pmax) {
      212.           j = (int)lh->num_alloc_nodes * 2;
                     ^
      213.           n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
      214.           if (n == NULL) {

crypto/lhash/lhash.c:186:1: <Length trace>
184.   }
185.   
186. > static int expand(OPENSSL_LHASH *lh)
187.   {
188.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:186:1: Parameter `*lh->b`
      184.   }
      185.   
      186. > static int expand(OPENSSL_LHASH *lh)
      187.   {
      188.       OPENSSL_LH_NODE **n, **n1, **n2, *np;

crypto/lhash/lhash.c:213:13: Call
      211.       if ((lh->p) >= lh->pmax) {
      212.           j = (int)lh->num_alloc_nodes * 2;
      213.           n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
                         ^
      214.           if (n == NULL) {
      215.               lh->error++;

crypto/mem.c:240:9: Assignment
        238.       if (num == 0) {
        239.           CRYPTO_free(str, file, line);
        240.           return NULL;
                       ^
        241.       }
        242.   

crypto/lhash/lhash.c:213:9: Assignment
      211.       if ((lh->p) >= lh->pmax) {
      212.           j = (int)lh->num_alloc_nodes * 2;
      213.           n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
                     ^
      214.           if (n == NULL) {
      215.               lh->error++;

crypto/lhash/lhash.c:221:13: Array access: Offset: [16, +oo] Size: [1, +oo] by call to `lh_OSSL_STORE_LOADER_insert` 
      219.           }
      220.           for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
      221.               n[i] = NULL;        /* 02/03/92 eay */
                         ^
      222.           lh->pmax = lh->num_alloc_nodes;
      223.           lh->num_alloc_nodes = j;

static int expand(OPENSSL_LHASH *lh)
{
    OPENSSL_LH_NODE **n, **n1, **n2, *np;
    unsigned int p, i, j;
    unsigned long hash, nni;
    lh->num_nodes++;
    lh->num_expands++;
    p = (int)lh->p++;
    n1 = &(lh->b[p]);
    n2 = &(lh->b[p + (int)lh->pmax]);
    *n2 = NULL;
    nni = lh->num_alloc_nodes;
    for (np = *n1; np != NULL;) {
        hash = np->hash;
        if ((hash % nni) != p) {
            *n1 = (*n1)->next;
            np->next = *n2;
            *n2 = np;
        } else
            n1 = &((*n1)->next);
        np = *n1;
    }
    if ((lh->p) >= lh->pmax) {
        j = (int)lh->num_alloc_nodes * 2;
        n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
        if (n == NULL) {
            lh->error++;
            lh->num_nodes--;
            lh->p = 0;
            return 0;
        }
        for (i = (int)lh->num_alloc_nodes; i < j; i++)
            n[i] = NULL;
        lh->pmax = lh->num_alloc_nodes;
        lh->num_alloc_nodes = j;
        lh->num_expand_reallocs++;
        lh->p = 0;
        lh->b = n;
    }
    return 1;
}
['int ossl_store_register_loader_int(OSSL_STORE_LOADER *loader)\n{\n    const char *scheme = loader->scheme;\n    int ok = 0;\n    if (ossl_isalpha(*scheme))\n        while (*scheme != \'\\0\'\n               && (ossl_isalpha(*scheme)\n                   || ossl_isdigit(*scheme)\n                   || strchr("+-.", *scheme) != NULL))\n            scheme++;\n    if (*scheme != \'\\0\') {\n        OSSL_STOREerr(OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT,\n                      OSSL_STORE_R_INVALID_SCHEME);\n        ERR_add_error_data(2, "scheme=", loader->scheme);\n        return 0;\n    }\n    if (loader->open == NULL || loader->load == NULL || loader->eof == NULL\n        || loader->error == NULL || loader->close == NULL) {\n        OSSL_STOREerr(OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT,\n                      OSSL_STORE_R_LOADER_INCOMPLETE);\n        return 0;\n    }\n    if (!RUN_ONCE(&registry_init, do_registry_init)) {\n        OSSL_STOREerr(OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT,\n                      ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    CRYPTO_THREAD_write_lock(registry_lock);\n    if (loader_register == NULL) {\n        loader_register = lh_OSSL_STORE_LOADER_new(store_loader_hash,\n                                                   store_loader_cmp);\n    }\n    if (loader_register != NULL\n        && (lh_OSSL_STORE_LOADER_insert(loader_register, loader) != NULL\n            || lh_OSSL_STORE_LOADER_error(loader_register) == 0))\n        ok = 1;\n    CRYPTO_THREAD_unlock(registry_lock);\n    return ok;\n}', 'DEFINE_LHASH_OF(OSSL_STORE_LOADER)', 'OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c)\n{\n    OPENSSL_LHASH *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)\n        return NULL;\n    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)\n        goto err;\n    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);\n    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);\n    ret->num_nodes = MIN_NODES / 2;\n    ret->num_alloc_nodes = MIN_NODES;\n    ret->pmax = MIN_NODES / 2;\n    ret->up_load = UP_LOAD;\n    ret->down_load = DOWN_LOAD;\n    return ret;\nerr:\n    OPENSSL_free(ret->b);\n    OPENSSL_free(ret);\n    return NULL;\n}', 'void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))\n        return NULL;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {\n            lh->error++;\n            return NULL;\n        }\n        nn->data = data;\n        nn->next = NULL;\n        nn->hash = hash;\n        *rn = nn;\n        ret = NULL;\n        lh->num_insert++;\n        lh->num_items++;\n    } else {\n        ret = (*rn)->data;\n        (*rn)->data = data;\n        lh->num_replace++;\n    }\n    return ret;\n}', 'static int expand(OPENSSL_LHASH *lh)\n{\n    OPENSSL_LH_NODE **n, **n1, **n2, *np;\n    unsigned int p, i, j;\n    unsigned long hash, nni;\n    lh->num_nodes++;\n    lh->num_expands++;\n    p = (int)lh->p++;\n    n1 = &(lh->b[p]);\n    n2 = &(lh->b[p + (int)lh->pmax]);\n    *n2 = NULL;\n    nni = lh->num_alloc_nodes;\n    for (np = *n1; np != NULL;) {\n        hash = np->hash;\n        if ((hash % nni) != p) {\n            *n1 = (*n1)->next;\n            np->next = *n2;\n            *n2 = np;\n        } else\n            n1 = &((*n1)->next);\n        np = *n1;\n    }\n    if ((lh->p) >= lh->pmax) {\n        j = (int)lh->num_alloc_nodes * 2;\n        n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));\n        if (n == NULL) {\n            lh->error++;\n            lh->num_nodes--;\n            lh->p = 0;\n            return 0;\n        }\n        for (i = (int)lh->num_alloc_nodes; i < j; i++)\n            n[i] = NULL;\n        lh->pmax = lh->num_alloc_nodes;\n        lh->num_alloc_nodes = j;\n        lh->num_expand_reallocs++;\n        lh->p = 0;\n        lh->b = n;\n    }\n    return 1;\n}', 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    INCREMENT(realloc_count);\n    if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)\n        return realloc_impl(str, num, file, line);\n    FAILTEST();\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str, file, line);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)(file); (void)(line);\n#endif\n    return realloc(str, num);\n}']