crypto/ec/ecp_smpl.c:729: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_copy`.
Showing all 10 steps of the trace


crypto/ec/ecp_smpl.c:653:14: Call
651.       /* n1, n2 */
652.       if (b->Z_is_one) {
653.           if (!BN_copy(n1, a->X))
                    ^
654.               goto end;
655.           if (!BN_copy(n2, a->Y))

crypto/bn/bn_lib.c:280:1: Parameter `a->top`
  278.   }
  279.   
  280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
  281.   {
  282.       bn_check_top(b);

crypto/ec/ecp_smpl.c:729:14: Call
727.       /* Z_r */
728.       if (a->Z_is_one && b->Z_is_one) {
729.           if (!BN_copy(r->Z, n5))
                    ^
730.               goto end;
731.       } else {

crypto/bn/bn_lib.c:280:1: <Offset trace>
278.   }
279.   
280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
281.   {
282.       bn_check_top(b);

crypto/bn/bn_lib.c:280:1: Parameter `b->top`
  278.   }
  279.   
  280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
  281.   {
  282.       bn_check_top(b);

crypto/bn/bn_lib.c:280:1: <Length trace>
278.   }
279.   
280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
281.   {
282.       bn_check_top(b);

crypto/bn/bn_lib.c:280:1: Parameter `*a->d`
  278.   }
  279.   
  280. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
  281.   {
  282.       bn_check_top(b);

crypto/bn/bn_lib.c:286:9: Call
  284.       if (a == b)
  285.           return a;
  286.       if (bn_wexpand(a, b->top) == NULL)
                 ^
  287.           return NULL;
  288.   

crypto/bn/bn_lib.c:942:1: Parameter `*a->d`
    940.   }
    941.   
    942. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
    943.   {
    944.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:290:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_copy` 
  288.   
  289.       if (b->top > 0)
  290.           memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
                 ^
  291.   
  292.       a->neg = b->neg;

BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
    bn_check_top(b);
    if (a == b)
        return a;
    if (bn_wexpand(a, b->top) == NULL)
        return NULL;
    if (b->top > 0)
        memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
    a->neg = b->neg;
    a->top = b->top;
    a->flags |= b->flags & BN_FLG_FIXED_TOP;
    bn_check_top(a);
    return a;
}
['int ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,\n                      const EC_POINT *b, BN_CTX *ctx)\n{\n    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,\n                      const BIGNUM *, BN_CTX *);\n    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);\n    const BIGNUM *p;\n    BN_CTX *new_ctx = NULL;\n    BIGNUM *n0, *n1, *n2, *n3, *n4, *n5, *n6;\n    int ret = 0;\n    if (a == b)\n        return EC_POINT_dbl(group, r, a, ctx);\n    if (EC_POINT_is_at_infinity(group, a))\n        return EC_POINT_copy(r, b);\n    if (EC_POINT_is_at_infinity(group, b))\n        return EC_POINT_copy(r, a);\n    field_mul = group->meth->field_mul;\n    field_sqr = group->meth->field_sqr;\n    p = group->field;\n    if (ctx == NULL) {\n        ctx = new_ctx = BN_CTX_new();\n        if (ctx == NULL)\n            return 0;\n    }\n    BN_CTX_start(ctx);\n    n0 = BN_CTX_get(ctx);\n    n1 = BN_CTX_get(ctx);\n    n2 = BN_CTX_get(ctx);\n    n3 = BN_CTX_get(ctx);\n    n4 = BN_CTX_get(ctx);\n    n5 = BN_CTX_get(ctx);\n    n6 = BN_CTX_get(ctx);\n    if (n6 == NULL)\n        goto end;\n    if (b->Z_is_one) {\n        if (!BN_copy(n1, a->X))\n            goto end;\n        if (!BN_copy(n2, a->Y))\n            goto end;\n    } else {\n        if (!field_sqr(group, n0, b->Z, ctx))\n            goto end;\n        if (!field_mul(group, n1, a->X, n0, ctx))\n            goto end;\n        if (!field_mul(group, n0, n0, b->Z, ctx))\n            goto end;\n        if (!field_mul(group, n2, a->Y, n0, ctx))\n            goto end;\n    }\n    if (a->Z_is_one) {\n        if (!BN_copy(n3, b->X))\n            goto end;\n        if (!BN_copy(n4, b->Y))\n            goto end;\n    } else {\n        if (!field_sqr(group, n0, a->Z, ctx))\n            goto end;\n        if (!field_mul(group, n3, b->X, n0, ctx))\n            goto end;\n        if (!field_mul(group, n0, n0, a->Z, ctx))\n            goto end;\n        if (!field_mul(group, n4, b->Y, n0, ctx))\n            goto end;\n    }\n    if (!BN_mod_sub_quick(n5, n1, n3, p))\n        goto end;\n    if (!BN_mod_sub_quick(n6, n2, n4, p))\n        goto end;\n    if (BN_is_zero(n5)) {\n        if (BN_is_zero(n6)) {\n            BN_CTX_end(ctx);\n            ret = EC_POINT_dbl(group, r, a, ctx);\n            ctx = NULL;\n            goto end;\n        } else {\n            BN_zero(r->Z);\n            r->Z_is_one = 0;\n            ret = 1;\n            goto end;\n        }\n    }\n    if (!BN_mod_add_quick(n1, n1, n3, p))\n        goto end;\n    if (!BN_mod_add_quick(n2, n2, n4, p))\n        goto end;\n    if (a->Z_is_one && b->Z_is_one) {\n        if (!BN_copy(r->Z, n5))\n            goto end;\n    } else {\n        if (a->Z_is_one) {\n            if (!BN_copy(n0, b->Z))\n                goto end;\n        } else if (b->Z_is_one) {\n            if (!BN_copy(n0, a->Z))\n                goto end;\n        } else {\n            if (!field_mul(group, n0, a->Z, b->Z, ctx))\n                goto end;\n        }\n        if (!field_mul(group, r->Z, n0, n5, ctx))\n            goto end;\n    }\n    r->Z_is_one = 0;\n    if (!field_sqr(group, n0, n6, ctx))\n        goto end;\n    if (!field_sqr(group, n4, n5, ctx))\n        goto end;\n    if (!field_mul(group, n3, n1, n4, ctx))\n        goto end;\n    if (!BN_mod_sub_quick(r->X, n0, n3, p))\n        goto end;\n    if (!BN_mod_lshift1_quick(n0, r->X, p))\n        goto end;\n    if (!BN_mod_sub_quick(n0, n3, n0, p))\n        goto end;\n    if (!field_mul(group, n0, n0, n6, ctx))\n        goto end;\n    if (!field_mul(group, n5, n4, n5, ctx))\n        goto end;\n    if (!field_mul(group, n1, n2, n5, ctx))\n        goto end;\n    if (!BN_mod_sub_quick(n0, n0, n1, p))\n        goto end;\n    if (BN_is_odd(n0))\n        if (!BN_add(n0, n0, p))\n            goto end;\n    if (!BN_rshift1(r->Y, n0))\n        goto end;\n    ret = 1;\n end:\n    if (ctx)\n        BN_CTX_end(ctx);\n    BN_CTX_free(new_ctx);\n    return ret;\n}', 'BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)\n{\n    bn_check_top(b);\n    if (a == b)\n        return a;\n    if (bn_wexpand(a, b->top) == NULL)\n        return NULL;\n    if (b->top > 0)\n        memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);\n    a->neg = b->neg;\n    a->top = b->top;\n    a->flags |= b->flags & BN_FLG_FIXED_TOP;\n    bn_check_top(a);\n    return a;\n}', 'BIGNUM *bn_wexpand(BIGNUM *a, int words)\n{\n    return (words <= a->dmax) ? a : bn_expand2(a, words);\n}']