test/bntest.c:1580: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_sqrt`.
Showing all 31 steps of the trace


test/bntest.c:1580:10: Call
1578.   
1579.       /* There are two possible answers. */
1580.       if (!TEST_true(BN_mod_sqrt(ret, a, p, ctx))
                 ^
1581.               || !TEST_true(BN_sub(ret2, p, ret)))
1582.           goto err;

crypto/bn/bn_sqrt.c:13:1: Parameter `ctx->stack.depth`
  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:59:5: Call
  57.       }
  58.   
  59.       BN_CTX_start(ctx);
            ^
  60.       A = BN_CTX_get(ctx);
  61.       b = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
    169.   }
    170.   
    171. > void BN_CTX_start(BN_CTX *ctx)
    172.   {
    173.       CTXDBG("ENTER BN_CTX_start()", ctx);

crypto/bn/bn_sqrt.c:60:9: Call
  58.   
  59.       BN_CTX_start(ctx);
  60.       A = BN_CTX_get(ctx);
                ^
  61.       b = BN_CTX_get(ctx);
  62.       q = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
    200.   }
    201.   
    202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    203.   {
    204.       BIGNUM *ret;

crypto/bn/bn_sqrt.c:61:9: Call
  59.       BN_CTX_start(ctx);
  60.       A = BN_CTX_get(ctx);
  61.       b = BN_CTX_get(ctx);
                ^
  62.       q = BN_CTX_get(ctx);
  63.       t = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
    200.   }
    201.   
    202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    203.   {
    204.       BIGNUM *ret;

crypto/bn/bn_sqrt.c:62:9: Call
  60.       A = BN_CTX_get(ctx);
  61.       b = BN_CTX_get(ctx);
  62.       q = BN_CTX_get(ctx);
                ^
  63.       t = BN_CTX_get(ctx);
  64.       x = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
    200.   }
    201.   
    202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    203.   {
    204.       BIGNUM *ret;

crypto/bn/bn_sqrt.c:63:9: Call
  61.       b = BN_CTX_get(ctx);
  62.       q = BN_CTX_get(ctx);
  63.       t = BN_CTX_get(ctx);
                ^
  64.       x = BN_CTX_get(ctx);
  65.       y = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
    200.   }
    201.   
    202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    203.   {
    204.       BIGNUM *ret;

crypto/bn/bn_sqrt.c:64:9: Call
  62.       q = BN_CTX_get(ctx);
  63.       t = BN_CTX_get(ctx);
  64.       x = BN_CTX_get(ctx);
                ^
  65.       y = BN_CTX_get(ctx);
  66.       if (y == NULL)

crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
    200.   }
    201.   
    202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    203.   {
    204.       BIGNUM *ret;

crypto/bn/bn_sqrt.c:65:9: Call
  63.       t = BN_CTX_get(ctx);
  64.       x = BN_CTX_get(ctx);
  65.       y = BN_CTX_get(ctx);
                ^
  66.       if (y == NULL)
  67.           goto end;

crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
    200.   }
    201.   
    202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    203.   {
    204.       BIGNUM *ret;

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 `ctx->stack.depth`
    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:209:1: Parameter `ctx->stack.depth`
      207.    * If 'dv' or 'rm' is NULL, the respective value is not returned.
      208.    */
      209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
      210.              BN_CTX *ctx)
      211.   {

crypto/bn/bn_div.c:229:11: Call
      227.       }
      228.   
      229.       ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
                       ^
      230.   
      231.       if (ret) {

crypto/bn/bn_div.c:280:5: Call
        278.       bn_check_top(rm);
        279.   
        280.       BN_CTX_start(ctx);
                   ^
        281.       res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
        282.       tmp = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
          169.   }
          170.   
          171. > void BN_CTX_start(BN_CTX *ctx)
          172.   {
          173.       CTXDBG("ENTER BN_CTX_start()", ctx);

crypto/bn/bn_div.c:450:5: Call
        448.       if (rm != NULL)
        449.           bn_rshift_fixed_top(rm, snum, norm_shift);
        450.       BN_CTX_end(ctx);
                   ^
        451.       return 1;
        452.    err:

crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
          183.   }
          184.   
          185. > void BN_CTX_end(BN_CTX *ctx)
          186.   {
          187.       CTXDBG("ENTER BN_CTX_end()", ctx);

crypto/bn/bn_ctx.c:191:27: Call
          189.           ctx->err_stack--;
          190.       else {
          191.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                           ^
          192.           /* Does this stack frame have anything to release? */
          193.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:266:1: <Offset trace>
264.   }
265.   
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267.   {
268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
            264.   }
            265.   
            266. > static unsigned int BN_STACK_pop(BN_STACK *st)
            267.   {
            268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:266:1: <Length trace>
264.   }
265.   
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267.   {
268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
            264.   }
            265.   
            266. > static unsigned int BN_STACK_pop(BN_STACK *st)
            267.   {
            268.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_sqrt` 
            266.   static unsigned int BN_STACK_pop(BN_STACK *st)
            267.   {
            268.       return st->indexes[--(st->depth)];
                              ^
            269.   }
            270.   
