crypto/ec/eck_prn.c:147: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `EC_POINT_point2bn`.
Showing all 14 steps of the trace


crypto/ec/eck_prn.c:147:20: Call
145.           form = EC_GROUP_get_point_conversion_form(x);
146.   
147.           if ((gen = EC_POINT_point2bn(x, point, form, NULL, ctx)) == NULL) {
                          ^
148.               reason = ERR_R_EC_LIB;
149.               goto err;

crypto/ec/ec_print.c:14:1: Parameter `ctx->stack.depth`
  12.   #include "ec_lcl.h"
  13.   
  14. > BIGNUM *EC_POINT_point2bn(const EC_GROUP *group,
  15.                             const EC_POINT *point,
  16.                             point_conversion_form_t form,

crypto/ec/ec_print.c:22:15: Call
  20.       unsigned char *buf;
  21.   
  22.       buf_len = EC_POINT_point2buf(group, point, form, &buf, ctx);
                      ^
  23.   
  24.       if (buf_len == 0)

crypto/ec/ec_oct.c:129:1: Parameter `ctx->stack.depth`
    127.   }
    128.   
    129. > size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,
    130.                             point_conversion_form_t form,
    131.                             unsigned char **pbuf, BN_CTX *ctx)

crypto/ec/ec_oct.c:143:11: Call
    141.           return 0;
    142.       }
    143.       len = EC_POINT_point2oct(group, point, form, buf, len, ctx);
                     ^
    144.       if (len == 0) {
    145.           OPENSSL_free(buf);

crypto/ec/ec_oct.c:70:1: Parameter `ctx->stack.depth`
      68.   #endif
      69.   
      70. > size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
      71.                             point_conversion_form_t form, unsigned char *buf,
      72.                             size_t len, BN_CTX *ctx)

crypto/ec/ec_oct.c:93:20: Call
      91.           }
      92.   #else
      93.               return ec_GF2m_simple_point2oct(group, point,
                               ^
      94.                                               form, buf, len, ctx);
      95.   #endif

crypto/ec/ec2_oct.c:121:1: Parameter `ctx->stack.depth`
        119.    * an error will be returned.
        120.    */
        121. > size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
        122.                                   point_conversion_form_t form,
        123.                                   unsigned char *buf, size_t len, BN_CTX *ctx)

crypto/ec/ec2_oct.c:232:9: Call
        230.   
        231.       if (used_ctx)
        232.           BN_CTX_end(ctx);
                       ^
        233.   #ifndef FIPS_MODE
        234.       BN_CTX_free(new_ctx);

crypto/bn/bn_ctx.c:208:1: Parameter `ctx->stack.depth`
          206.   }
          207.   
          208. > void BN_CTX_end(BN_CTX *ctx)
          209.   {
          210.       if (ctx == NULL)

crypto/bn/bn_ctx.c:216:27: Call
          214.           ctx->err_stack--;
          215.       else {
          216.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                           ^
          217.           /* Does this stack frame have anything to release? */
          218.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:298:1: <LHS trace>
296.   }
297.   
298. > static unsigned int BN_STACK_pop(BN_STACK *st)
299.   {
300.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:298:1: Parameter `st->depth`
            296.   }
            297.   
            298. > static unsigned int BN_STACK_pop(BN_STACK *st)
            299.   {
            300.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:300:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `EC_POINT_point2bn` 
            298.   static unsigned int BN_STACK_pop(BN_STACK *st)
            299.   {
            300.       return st->indexes[--(st->depth)];
                              ^
            301.   }
            302.   

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)\n{\n    int ret = 0, reason = ERR_R_BIO_LIB;\n    BN_CTX *ctx = NULL;\n    const EC_POINT *point = NULL;\n    BIGNUM *p = NULL, *a = NULL, *b = NULL, *gen = NULL;\n    const BIGNUM *order = NULL, *cofactor = NULL;\n    const unsigned char *seed;\n    size_t seed_len = 0;\n    static const char *gen_compressed = "Generator (compressed):";\n    static const char *gen_uncompressed = "Generator (uncompressed):";\n    static const char *gen_hybrid = "Generator (hybrid):";\n    if (!x) {\n        reason = ERR_R_PASSED_NULL_PARAMETER;\n        goto err;\n    }\n    ctx = BN_CTX_new();\n    if (ctx == NULL) {\n        reason = ERR_R_MALLOC_FAILURE;\n        goto err;\n    }\n    if (EC_GROUP_get_asn1_flag(x)) {\n        int nid;\n        const char *nname;\n        if (!BIO_indent(bp, off, 128))\n            goto err;\n        nid = EC_GROUP_get_curve_name(x);\n        if (nid == 0)\n            goto err;\n        if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0)\n            goto err;\n        if (BIO_printf(bp, "\\n") <= 0)\n            goto err;\n        nname = EC_curve_nid2nist(nid);\n        if (nname) {\n            if (!BIO_indent(bp, off, 128))\n                goto err;\n            if (BIO_printf(bp, "NIST CURVE: %s\\n", nname) <= 0)\n                goto err;\n        }\n    } else {\n        int is_char_two = 0;\n        point_conversion_form_t form;\n        int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));\n        if (tmp_nid == NID_X9_62_characteristic_two_field)\n            is_char_two = 1;\n        if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||\n            (b = BN_new()) == NULL) {\n            reason = ERR_R_MALLOC_FAILURE;\n            goto err;\n        }\n        if (!EC_GROUP_get_curve(x, p, a, b, ctx)) {\n            reason = ERR_R_EC_LIB;\n            goto err;\n        }\n        if ((point = EC_GROUP_get0_generator(x)) == NULL) {\n            reason = ERR_R_EC_LIB;\n            goto err;\n        }\n        order = EC_GROUP_get0_order(x);\n        cofactor = EC_GROUP_get0_cofactor(x);\n        if (order == NULL) {\n            reason = ERR_R_EC_LIB;\n            goto err;\n        }\n        form = EC_GROUP_get_point_conversion_form(x);\n        if ((gen = EC_POINT_point2bn(x, point, form, NULL, ctx)) == NULL) {\n            reason = ERR_R_EC_LIB;\n            goto err;\n        }\n        if ((seed = EC_GROUP_get0_seed(x)) != NULL)\n            seed_len = EC_GROUP_get_seed_len(x);\n        if (!BIO_indent(bp, off, 128))\n            goto err;\n        if (BIO_printf(bp, "Field Type: %s\\n", OBJ_nid2sn(tmp_nid))\n            <= 0)\n            goto err;\n        if (is_char_two) {\n            int basis_type = EC_GROUP_get_basis_type(x);\n            if (basis_type == 0)\n                goto err;\n            if (!BIO_indent(bp, off, 128))\n                goto err;\n            if (BIO_printf(bp, "Basis Type: %s\\n",\n                           OBJ_nid2sn(basis_type)) <= 0)\n                goto err;\n            if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, NULL,\n                                              off))\n                goto err;\n        } else {\n            if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, NULL, off))\n                goto err;\n        }\n        if ((a != NULL) && !ASN1_bn_print(bp, "A:   ", a, NULL, off))\n            goto err;\n        if ((b != NULL) && !ASN1_bn_print(bp, "B:   ", b, NULL, off))\n            goto err;\n        if (form == POINT_CONVERSION_COMPRESSED) {\n            if ((gen != NULL) && !ASN1_bn_print(bp, gen_compressed, gen,\n                                                NULL, off))\n                goto err;\n        } else if (form == POINT_CONVERSION_UNCOMPRESSED) {\n            if ((gen != NULL) && !ASN1_bn_print(bp, gen_uncompressed, gen,\n                                                NULL, off))\n                goto err;\n        } else {\n            if ((gen != NULL) && !ASN1_bn_print(bp, gen_hybrid, gen,\n                                                NULL, off))\n                goto err;\n        }\n        if ((order != NULL) && !ASN1_bn_print(bp, "Order: ", order,\n                                              NULL, off))\n            goto err;\n        if ((cofactor != NULL) && !ASN1_bn_print(bp, "Cofactor: ", cofactor,\n                                                 NULL, off))\n            goto err;\n        if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))\n            goto err;\n    }\n    ret = 1;\n err:\n    if (!ret)\n        ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);\n    BN_free(p);\n    BN_free(a);\n    BN_free(b);\n    BN_free(gen);\n    BN_CTX_free(ctx);\n    return ret;\n}', 'BIGNUM *EC_POINT_point2bn(const EC_GROUP *group,\n                          const EC_POINT *point,\n                          point_conversion_form_t form,\n                          BIGNUM *ret, BN_CTX *ctx)\n{\n    size_t buf_len = 0;\n    unsigned char *buf;\n    buf_len = EC_POINT_point2buf(group, point, form, &buf, ctx);\n    if (buf_len == 0)\n        return NULL;\n    ret = BN_bin2bn(buf, buf_len, ret);\n    OPENSSL_free(buf);\n    return ret;\n}', 'size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,\n                          point_conversion_form_t form,\n                          unsigned char **pbuf, BN_CTX *ctx)\n{\n    size_t len;\n    unsigned char *buf;\n    len = EC_POINT_point2oct(group, point, form, NULL, 0, NULL);\n    if (len == 0)\n        return 0;\n    if ((buf = OPENSSL_malloc(len)) == NULL) {\n        ECerr(EC_F_EC_POINT_POINT2BUF, ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    len = EC_POINT_point2oct(group, point, form, buf, len, ctx);\n    if (len == 0) {\n        OPENSSL_free(buf);\n        return 0;\n    }\n    *pbuf = buf;\n    return len;\n}', 'size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,\n                          point_conversion_form_t form, unsigned char *buf,\n                          size_t len, BN_CTX *ctx)\n{\n    if (group->meth->point2oct == 0\n        && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {\n        ECerr(EC_F_EC_POINT_POINT2OCT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return 0;\n    }\n    if (!ec_point_is_compat(point, group)) {\n        ECerr(EC_F_EC_POINT_POINT2OCT, EC_R_INCOMPATIBLE_OBJECTS);\n        return 0;\n    }\n    if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {\n        if (group->meth->field_type == NID_X9_62_prime_field)\n            return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);\n        else\n#ifdef OPENSSL_NO_EC2M\n        {\n            ECerr(EC_F_EC_POINT_POINT2OCT, EC_R_GF2M_NOT_SUPPORTED);\n            return 0;\n        }\n#else\n            return ec_GF2m_simple_point2oct(group, point,\n                                            form, buf, len, ctx);\n#endif\n    }\n    return group->meth->point2oct(group, point, form, buf, len, ctx);\n}', 'size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,\n                                point_conversion_form_t form,\n                                unsigned char *buf, size_t len, BN_CTX *ctx)\n{\n    size_t ret;\n    int used_ctx = 0;\n    BIGNUM *x, *y, *yxi;\n    size_t field_len, i, skip;\n#ifndef FIPS_MODE\n    BN_CTX *new_ctx = NULL;\n#endif\n    if ((form != POINT_CONVERSION_COMPRESSED)\n        && (form != POINT_CONVERSION_UNCOMPRESSED)\n        && (form != POINT_CONVERSION_HYBRID)) {\n        ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);\n        goto err;\n    }\n    if (EC_POINT_is_at_infinity(group, point)) {\n        if (buf != NULL) {\n            if (len < 1) {\n                ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);\n                return 0;\n            }\n            buf[0] = 0;\n        }\n        return 1;\n    }\n    field_len = (EC_GROUP_get_degree(group) + 7) / 8;\n    ret =\n        (form ==\n         POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;\n    if (buf != NULL) {\n        if (len < ret) {\n            ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);\n            goto err;\n        }\n#ifndef FIPS_MODE\n        if (ctx == NULL) {\n            ctx = new_ctx = BN_CTX_new();\n            if (ctx == NULL)\n                return 0;\n        }\n#endif\n        BN_CTX_start(ctx);\n        used_ctx = 1;\n        x = BN_CTX_get(ctx);\n        y = BN_CTX_get(ctx);\n        yxi = BN_CTX_get(ctx);\n        if (yxi == NULL)\n            goto err;\n        if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))\n            goto err;\n        buf[0] = form;\n        if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) {\n            if (!group->meth->field_div(group, yxi, y, x, ctx))\n                goto err;\n            if (BN_is_odd(yxi))\n                buf[0]++;\n        }\n        i = 1;\n        skip = field_len - BN_num_bytes(x);\n        if (skip > field_len) {\n            ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n        while (skip > 0) {\n            buf[i++] = 0;\n            skip--;\n        }\n        skip = BN_bn2bin(x, buf + i);\n        i += skip;\n        if (i != 1 + field_len) {\n            ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n        if (form == POINT_CONVERSION_UNCOMPRESSED\n            || form == POINT_CONVERSION_HYBRID) {\n            skip = field_len - BN_num_bytes(y);\n            if (skip > field_len) {\n                ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n                goto err;\n            }\n            while (skip > 0) {\n                buf[i++] = 0;\n                skip--;\n            }\n            skip = BN_bn2bin(y, buf + i);\n            i += skip;\n        }\n        if (i != ret) {\n            ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n    }\n    if (used_ctx)\n        BN_CTX_end(ctx);\n#ifndef FIPS_MODE\n    BN_CTX_free(new_ctx);\n#endif\n    return ret;\n err:\n    if (used_ctx)\n        BN_CTX_end(ctx);\n#ifndef FIPS_MODE\n    BN_CTX_free(new_ctx);\n#endif\n    return 0;\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 unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']