test/bntest.c:1512: error: BUFFER_OVERRUN_L3
  Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_sqrt`.
Showing all 26 steps of the trace


test/bntest.c:1502:24: Call
1500.       BIGNUM *a = getBN(s, "A");
1501.       BIGNUM *p = getBN(s, "P");
1502.       BIGNUM *mod_sqrt = getBN(s, "ModSqrt");
                               ^
1503.       BIGNUM *ret = BN_new();
1504.       BIGNUM *ret2 = BN_new();

test/bntest.c:115:9: Call
  113.       }
  114.   
  115.       if (parseBN(&ret, hex) != (int)strlen(hex)) {
                 ^
  116.           fprintf(stderr, "Could not decode '%s'.\n", hex);
  117.           return NULL;

test/bntest.c:95:12: Call
    93.   {
    94.       *out = NULL;
    95.       return BN_hex2bn(out, in);
                     ^
    96.   }
    97.   

crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top`
      124.   }
      125.   
      126. > int BN_hex2bn(BIGNUM **bn, const char *a)
      127.   {
      128.       BIGNUM *ret = NULL;

test/bntest.c:1512:10: Call
1510.   
1511.       /* There are two possible answers. */
1512.       if (!BN_mod_sqrt(ret, a, p, ctx) || !BN_sub(ret2, p, ret))
                 ^
1513.           goto err;
1514.   

crypto/bn/bn_sqrt.c:13:1: Parameter `p->top`
  11.   #include "bn_lcl.h"
  12.   
  13. > BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
  14.   /*
  15.    * Returns 'ret' such that ret^2 == a (mod p), using the Tonelli/Shanks

crypto/bn/bn_sqrt.c:26:10: Call
  24.       int e, i, j;
  25.   
  26.       if (!BN_is_odd(p) || BN_abs_is_word(p, 1)) {
                 ^
  27.           if (BN_abs_is_word(p, 2)) {
  28.               if (ret == NULL)

crypto/bn/bn_lib.c:935:1: Parameter `a->top`
    933.   }
    934.   
    935. > int BN_is_odd(const BIGNUM *a)
    936.   {
    937.       return (a->top > 0) && (a->d[0] & 1);

crypto/bn/bn_sqrt.c:26:26: Call
  24.       int e, i, j;
  25.   
  26.       if (!BN_is_odd(p) || BN_abs_is_word(p, 1)) {
                                 ^
  27.           if (BN_abs_is_word(p, 2)) {
  28.               if (ret == NULL)

crypto/bn/bn_lib.c:915:1: Parameter `a->top`
    913.   }
    914.   
    915. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
    916.   {
    917.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));

crypto/bn/bn_sqrt.c:75:10: Call
  73.   
  74.       /* A = a mod p */
  75.       if (!BN_nnmod(A, a, p, ctx))
                 ^
  76.           goto end;
  77.   

crypto/bn/bn_mod.c:13:1: Parameter `d->top`
    11.   #include "bn_lcl.h"
    12.   
    13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
    14.   {
    15.       /*

crypto/bn/bn_mod.c:20:11: Call
    18.        */
    19.   
    20.       if (!(BN_mod(r, m, d, ctx)))
                    ^
    21.           return 0;
    22.       if (!r->neg)

crypto/bn/bn_div.c:205:31: Call
      203.   
      204.       /* First we normalise the numbers */
      205.       norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
                                           ^
      206.       if (!(BN_lshift(sdiv, divisor, norm_shift)))
      207.           goto err;

crypto/bn/bn_lib.c:167:9: Assignment
        165.   
        166.       if (BN_is_zero(a))
        167.           return 0;
                       ^
        168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
        169.   }

crypto/bn/bn_div.c:205:5: Assignment
      203.   
      204.       /* First we normalise the numbers */
      205.       norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
                 ^
      206.       if (!(BN_lshift(sdiv, divisor, norm_shift)))
      207.           goto err;

crypto/bn/bn_div.c:206:11: Call
      204.       /* First we normalise the numbers */
      205.       norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
      206.       if (!(BN_lshift(sdiv, divisor, norm_shift)))
                       ^
      207.           goto err;
      208.       sdiv->neg = 0;

crypto/bn/bn_shift.c:83:1: <Offset trace>
81.   }
82.   
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84.   {
85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:83:1: Parameter `n`
        81.   }
        82.   
        83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
        84.   {
        85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:97:5: Assignment
        95.       }
        96.   
        97.       nw = n / BN_BITS2;
                   ^
        98.       if (bn_wexpand(r, a->top + nw + 1) == NULL)
        99.           return (0);

crypto/bn/bn_shift.c:83:1: <Length trace>
81.   }
82.   
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84.   {
85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
        81.   }
        82.   
        83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
        84.   {
        85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:98:9: Call
        96.   
        97.       nw = n / BN_BITS2;
        98.       if (bn_wexpand(r, a->top + nw + 1) == NULL)
                       ^
        99.           return (0);
        100.       r->neg = a->neg;

crypto/bn/bn_lib.c:1016:1: Parameter `*a->d`
          1014.   }
          1015.   
          1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
          1017.   {
          1018.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_shift.c:104:5: Assignment
        102.       rb = BN_BITS2 - lb;
        103.       f = a->d;
        104.       t = r->d;
                   ^
        105.       t[a->top + nw] = 0;
        106.       if (lb == 0)

crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_sqrt` 
        110.           for (i = a->top - 1; i >= 0; i--) {
        111.               l = f[i];
        112.               t[nw + i + 1] |= (l >> rb) & BN_MASK2;
                           ^
        113.               t[nw + i] = (l << lb) & BN_MASK2;
        114.           }
