test/bntest.c:490: error: BUFFER_OVERRUN_L3
  Offset added: 8 Size: [0, 67108856] by call to `BN_copy`.
Showing all 10 steps of the trace


test/bntest.c:490:20: Call
488.       for (i = 0; i < NUM0; i++) {
489.           BN_rand(a, 512, 0, 0);
490.           BN_copy(b, BN_value_one());
                          ^
491.           a->neg = rand_neg();
492.           b->neg = rand_neg();

crypto/bn/bn_lib.c:84:9: Assignment
  82.       static const BN_ULONG data_one = 1L;
  83.       static const BIGNUM const_one =
  84.           { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
                ^
  85.   
  86.       return (&const_one);

test/bntest.c:490:9: Call
488.       for (i = 0; i < NUM0; i++) {
489.           BN_rand(a, 512, 0, 0);
490.           BN_copy(b, BN_value_one());
               ^
491.           a->neg = rand_neg();
492.           b->neg = rand_neg();

crypto/bn/bn_lib.c:322:1: <Offset trace>
320.   }
321.   
322. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
323.   {
324.       bn_check_top(b);

crypto/bn/bn_lib.c:322:1: Parameter `b->top`
  320.   }
  321.   
  322. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
  323.   {
  324.       bn_check_top(b);

crypto/bn/bn_lib.c:322:1: <Length trace>
320.   }
321.   
322. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
323.   {
324.       bn_check_top(b);

crypto/bn/bn_lib.c:322:1: Parameter `*a->d`
  320.   }
  321.   
  322. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
  323.   {
  324.       bn_check_top(b);

crypto/bn/bn_lib.c:328:9: Call
  326.       if (a == b)
  327.           return a;
  328.       if (bn_wexpand(a, b->top) == NULL)
                 ^
  329.           return NULL;
  330.   

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

crypto/bn/bn_lib.c:331:5: Array access: Offset added: 8 Size: [0, 67108856] by call to `BN_copy` 
  329.           return NULL;
  330.   
  331.       memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
             ^
  332.   
  333.       a->top = b->top;

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;
    memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
    a->top = b->top;
    a->neg = b->neg;
    bn_check_top(a);
    return a;
}
['static int test_gf2m_add()\n{\n    BIGNUM *a, *b, *c;\n    int i, st = 0;\n    a = BN_new();\n    b = BN_new();\n    c = BN_new();\n    for (i = 0; i < NUM0; i++) {\n        BN_rand(a, 512, 0, 0);\n        BN_copy(b, BN_value_one());\n        a->neg = rand_neg();\n        b->neg = rand_neg();\n        BN_GF2m_add(c, a, b);\n        if ((BN_is_odd(a) && BN_is_odd(c))\n            || (!BN_is_odd(a) && !BN_is_odd(c))) {\n            printf("GF(2^m) addition test (a) failed!\\n");\n            goto err;\n        }\n        BN_GF2m_add(c, c, c);\n        if (!BN_is_zero(c)) {\n            printf("GF(2^m) addition test (b) failed!\\n");\n            goto err;\n        }\n    }\n    st = 1;\n err:\n    BN_free(a);\n    BN_free(b);\n    BN_free(c);\n    return st;\n}', 'const BIGNUM *BN_value_one(void)\n{\n    static const BN_ULONG data_one = 1L;\n    static const BIGNUM const_one =\n        { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };\n    return (&const_one);\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    memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);\n    a->top = b->top;\n    a->neg = b->neg;\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}']