crypto/rsa/rsa_sp800_56b_check.c:276: error: BUFFER_OVERRUN_L3
  Offset: 0 Size: [0, 8388607] by call to `BN_is_one`.
Showing all 8 steps of the trace


crypto/rsa/rsa_sp800_56b_check.c:276:10: Call
274.        * The modulus has no factors smaller than 752.
275.        */
276.       if (!BN_gcd(gcd, rsa->n, bn_get0_small_factors(), ctx) || !BN_is_one(gcd)) {
                ^
277.           RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_MODULUS);
278.           goto err;

crypto/bn/bn_gcd.c:15:1: Parameter `*r->d`
  13.   static BIGNUM *euclid(BIGNUM *a, BIGNUM *b);
  14.   
  15. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)
  16.   {
  17.       BIGNUM *a, *b, *t;

crypto/rsa/rsa_sp800_56b_check.c:276:64: Call
274.        * The modulus has no factors smaller than 752.
275.        */
276.       if (!BN_gcd(gcd, rsa->n, bn_get0_small_factors(), ctx) || !BN_is_one(gcd)) {
                                                                      ^
277.           RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_MODULUS);
278.           goto err;

crypto/bn/bn_lib.c:869:1: Parameter `*a->d`
  867.   }
  868.   
  869. > int BN_is_one(const BIGNUM *a)
  870.   {
  871.       return BN_abs_is_word(a, 1) && !a->neg;

crypto/bn/bn_lib.c:871:12: Call
  869.   int BN_is_one(const BIGNUM *a)
  870.   {
  871.       return BN_abs_is_word(a, 1) && !a->neg;
                    ^
  872.   }
  873.   

crypto/bn/bn_lib.c:859:1: <Length trace>
857.   }
858.   
859. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
860.   {
861.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));

crypto/bn/bn_lib.c:859:1: Parameter `*a->d`
    857.   }
    858.   
    859. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
    860.   {
    861.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));

crypto/bn/bn_lib.c:861:31: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_is_one` 
    859.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
    860.   {
    861.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                                         ^
    862.   }
    863.   

int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
{
    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
}
['int rsa_sp800_56b_check_public(const RSA *rsa)\n{\n    int ret = 0, nbits, iterations, status;\n    BN_CTX *ctx = NULL;\n    BIGNUM *gcd = NULL;\n    if (rsa->n == NULL || rsa->e == NULL)\n        return 0;\n    nbits = BN_num_bits(rsa->n);\n    if (!rsa_sp800_56b_validate_strength(nbits, -1)) {\n        RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_KEY_LENGTH);\n        return 0;\n    }\n    if (!BN_is_odd(rsa->n)) {\n        RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_MODULUS);\n        return 0;\n    }\n    if (!rsa_check_public_exponent(rsa->e)) {\n        RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC,\n               RSA_R_PUB_EXPONENT_OUT_OF_RANGE);\n        return 0;\n    }\n    ctx = BN_CTX_new();\n    gcd = BN_new();\n    if (ctx == NULL || gcd == NULL)\n        goto err;\n    iterations = bn_rsa_fips186_4_prime_MR_min_checks(nbits);\n    if (!BN_gcd(gcd, rsa->n, bn_get0_small_factors(), ctx) || !BN_is_one(gcd)) {\n        RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_MODULUS);\n        goto err;\n    }\n    ret = bn_miller_rabin_is_prime(rsa->n, iterations, ctx, NULL, 1, &status);\n    if (ret != 1 || status != BN_PRIMETEST_COMPOSITE_NOT_POWER_OF_PRIME) {\n        RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_MODULUS);\n        ret = 0;\n        goto err;\n    }\n    ret = 1;\nerr:\n    BN_free(gcd);\n    BN_CTX_free(ctx);\n    return ret;\n}', 'int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)\n{\n    BIGNUM *a, *b, *t;\n    int ret = 0;\n    bn_check_top(in_a);\n    bn_check_top(in_b);\n    BN_CTX_start(ctx);\n    a = BN_CTX_get(ctx);\n    b = BN_CTX_get(ctx);\n    if (b == NULL)\n        goto err;\n    if (BN_copy(a, in_a) == NULL)\n        goto err;\n    if (BN_copy(b, in_b) == NULL)\n        goto err;\n    a->neg = 0;\n    b->neg = 0;\n    if (BN_cmp(a, b) < 0) {\n        t = a;\n        a = b;\n        b = t;\n    }\n    t = euclid(a, b);\n    if (t == NULL)\n        goto err;\n    if (BN_copy(r, t) == NULL)\n        goto err;\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    bn_check_top(r);\n    return ret;\n}', 'int BN_is_one(const BIGNUM *a)\n{\n    return BN_abs_is_word(a, 1) && !a->neg;\n}', 'int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)\n{\n    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));\n}']