crypto/bn/bn_gf2m.c:782: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 9 steps of the trace


crypto/bn/bn_gf2m.c:765:1: Parameter `ctx->pool.used`
763.    * use the BN_GF2m_mod_inv function.
764.    */
765. > int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[],
766.                           BN_CTX *ctx)
767.   {

crypto/bn/bn_gf2m.c:773:18: Call
771.       bn_check_top(xx);
772.       BN_CTX_start(ctx);
773.       if ((field = BN_CTX_get(ctx)) == NULL)
                        ^
774.           goto err;
775.       if (!BN_GF2m_arr2poly(p, field))

crypto/bn/bn_ctx.c:204:1: Parameter `ctx->pool.used`
  202.   }
  203.   
  204. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  205.   {
  206.       BIGNUM *ret;

crypto/bn/bn_gf2m.c:782:5: Call
780.   
781.    err:
782.       BN_CTX_end(ctx);
           ^
783.       return ret;
784.   }

crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used`
  183.   }
  184.   
  185. > void BN_CTX_end(BN_CTX *ctx)
  186.   {
  187.       if (ctx == NULL)

crypto/bn/bn_ctx.c:196:13: Call
  194.           /* Does this stack frame have anything to release? */
  195.           if (fp < ctx->used)
  196.               BN_POOL_release(&ctx->pool, ctx->used - fp);
                     ^
  197.           ctx->used = fp;
  198.           /* Unjam "too_many" in case "get" had failed */

crypto/bn/bn_ctx.c:340:1: <LHS trace>
338.   }
339.   
340. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
341.   {
342.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:340:1: Parameter `p->used`
    338.   }
    339.   
    340. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
    341.   {
    342.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:342:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    340.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
    341.   {
    342.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
               ^
    343.   
    344.       p->used -= num;

static void BN_POOL_release(BN_POOL *p, unsigned int num)
{
    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
    p->used -= num;
    while (num--) {
        bn_check_top(p->current->vals + offset);
        if (offset == 0) {
            offset = BN_CTX_POOL_SIZE - 1;
            p->current = p->current->prev;
        } else
            offset--;
    }
}
['int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[],\n                        BN_CTX *ctx)\n{\n    BIGNUM *field;\n    int ret = 0;\n    bn_check_top(xx);\n    BN_CTX_start(ctx);\n    if ((field = BN_CTX_get(ctx)) == NULL)\n        goto err;\n    if (!BN_GF2m_arr2poly(p, field))\n        goto err;\n    ret = BN_GF2m_mod_inv(r, xx, field, ctx);\n    bn_check_top(r);\n err:\n    BN_CTX_end(ctx);\n    return ret;\n}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n{\n    BIGNUM *ret;\n    CTXDBG("ENTER BN_CTX_get()", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        return NULL;\n    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {\n        ctx->too_many = 1;\n        BNerr(BN_F_BN_CTX_GET, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        return NULL;\n    }\n    BN_zero(ret);\n    ret->flags &= (~BN_FLG_CONSTTIME);\n    ctx->used++;\n    CTXDBG("LEAVE BN_CTX_get()", ctx);\n    return ret;\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    if (ctx == NULL)\n        return;\n    CTXDBG("ENTER BN_CTX_end()", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG("LEAVE BN_CTX_end()", ctx);\n}', 'static void BN_POOL_release(BN_POOL *p, unsigned int num)\n{\n    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;\n    p->used -= num;\n    while (num--) {\n        bn_check_top(p->current->vals + offset);\n        if (offset == 0) {\n            offset = BN_CTX_POOL_SIZE - 1;\n            p->current = p->current->prev;\n        } else\n            offset--;\n    }\n}']