test/asynctest.c:233: error: INTEGER_OVERFLOW_L1
  ([-oo, 0] - 1):unsigned64 by call to `ASYNC_init`.
Showing all 6 steps of the trace


test/asynctest.c:233:17: Call
231.       OSSL_ASYNC_FD fd;
232.   
233.       if (       !ASYNC_init(1, 1, 0)
                       ^
234.               || ASYNC_start_job(&job, &funcret, wake, NULL, 0)
235.                   != ASYNC_PAUSE

crypto/async/async.c:335:1: Parameter `init_size`
  333.   }
  334.   
  335. > int ASYNC_init(int init_thread, size_t max_size, size_t init_size)
  336.   {
  337.       if (!async_global_init())

crypto/async/async.c:341:16: Call
  339.   
  340.       if (init_thread)
  341.           return ASYNC_init_thread(max_size, init_size);
                        ^
  342.   
  343.       return 1;

crypto/async/async.c:346:1: <LHS trace>
344.   }
345.   
346. > int ASYNC_init_thread(size_t max_size, size_t init_size)
347.   {
348.       async_pool *pool;

crypto/async/async.c:346:1: Parameter `init_size`
    344.   }
    345.   
    346. > int ASYNC_init_thread(size_t max_size, size_t init_size)
    347.   {
    348.       async_pool *pool;

crypto/async/async.c:376:12: Binary operation: ([-oo, 0] - 1):unsigned64 by call to `ASYNC_init` 
    374.   
    375.       /* Pre-create jobs as required */
    376.       while (init_size--) {
                      ^
    377.           ASYNC_JOB *job;
    378.           job = async_job_new();

int ASYNC_init_thread(size_t max_size, size_t init_size)
{
    async_pool *pool;
    size_t curr_size = 0;
    if (init_size > max_size) {
        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INVALID_POOL_SIZE);
        return 0;
    }
    if (!async_local_init()) {
        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INIT_FAILED);
        return 0;
    }
    pool = OPENSSL_zalloc(sizeof *pool);
    if (pool == NULL) {
        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
        return 0;
    }
    pool->jobs = sk_ASYNC_JOB_new_null();
    if (pool->jobs == NULL) {
        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
        OPENSSL_free(pool);
        return 0;
    }
    pool->max_size = max_size;
    while (init_size--) {
        ASYNC_JOB *job;
        job = async_job_new();
        if (job == NULL || !async_fibre_makecontext(&job->fibrectx)) {
            async_job_free(job);
            break;
        }
        job->funcargs = NULL;
        sk_ASYNC_JOB_push(pool->jobs, job);
        curr_size++;
    }
    pool->curr_size = curr_size;
    if (!async_set_pool(pool)) {
        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);
        goto err;
    }
    return 1;
err:
    async_free_pool_internal(pool);
    return 0;
}
['static int test_ASYNC_get_wait_fd()\n{\n    ASYNC_JOB *job = NULL;\n    int funcret;\n    OSSL_ASYNC_FD fd;\n    if (       !ASYNC_init(1, 1, 0)\n            || ASYNC_start_job(&job, &funcret, wake, NULL, 0)\n                != ASYNC_PAUSE\n            || (fd = ASYNC_get_wait_fd(job)) < 0\n            || hasdata(fd) != 0\n            || ASYNC_start_job(&job, &funcret, save_current, NULL, 0)\n                != ASYNC_PAUSE\n            || hasdata(fd) != 1\n            || (ASYNC_clear_wake(job), 0)\n            || hasdata(fd) != 0\n            || (ASYNC_wake(job), 0)\n            || hasdata(fd) != 1\n            || ASYNC_start_job(&job, &funcret, save_current, NULL, 0)\n                != ASYNC_FINISH\n            || funcret != 1) {\n        fprintf(stderr, "test_ASYNC_get_wait_fd() failed\\n");\n        ASYNC_cleanup(1);\n        return 0;\n    }\n    ASYNC_cleanup(1);\n    return 1;\n}', 'int ASYNC_init(int init_thread, size_t max_size, size_t init_size)\n{\n    if (!async_global_init())\n        return 0;\n    if (init_thread)\n        return ASYNC_init_thread(max_size, init_size);\n    return 1;\n}', 'int ASYNC_init_thread(size_t max_size, size_t init_size)\n{\n    async_pool *pool;\n    size_t curr_size = 0;\n    if (init_size > max_size) {\n        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INVALID_POOL_SIZE);\n        return 0;\n    }\n    if (!async_local_init()) {\n        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INIT_FAILED);\n        return 0;\n    }\n    pool = OPENSSL_zalloc(sizeof *pool);\n    if (pool == NULL) {\n        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    pool->jobs = sk_ASYNC_JOB_new_null();\n    if (pool->jobs == NULL) {\n        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);\n        OPENSSL_free(pool);\n        return 0;\n    }\n    pool->max_size = max_size;\n    while (init_size--) {\n        ASYNC_JOB *job;\n        job = async_job_new();\n        if (job == NULL || !async_fibre_makecontext(&job->fibrectx)) {\n            async_job_free(job);\n            break;\n        }\n        job->funcargs = NULL;\n        sk_ASYNC_JOB_push(pool->jobs, job);\n        curr_size++;\n    }\n    pool->curr_size = curr_size;\n    if (!async_set_pool(pool)) {\n        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);\n        goto err;\n    }\n    return 1;\nerr:\n    async_free_pool_internal(pool);\n    return 0;\n}']