crypto/bn/bn_mont.c:375: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_div`.
Showing all 36 steps of the trace


crypto/bn/bn_mont.c:247:1: Parameter `mont->RR.top`
245.   }
246.   
247. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
248.   {
249.       int ret = 0;

crypto/bn/bn_mont.c:321:9: Call
319.           mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0;
320.   # else
321.           BN_zero(R);
               ^
322.           if (!(BN_set_bit(R, BN_BITS2)))
323.               goto err;           /* R */

crypto/bn/bn_lib.c:394:15: Assignment
  392.       a->neg = 0;
  393.       a->d[0] = w;
  394.       a->top = (w ? 1 : 0);
                       ^
  395.       bn_check_top(a);
  396.       return 1;

crypto/bn/bn_lib.c:394:5: Assignment
  392.       a->neg = 0;
  393.       a->d[0] = w;
  394.       a->top = (w ? 1 : 0);
             ^
  395.       bn_check_top(a);
  396.       return 1;

crypto/bn/bn_mont.c:322:15: Call
320.   # else
321.           BN_zero(R);
322.           if (!(BN_set_bit(R, BN_BITS2)))
                     ^
323.               goto err;           /* R */
324.   

crypto/bn/bn_lib.c:616:1: Parameter `a->top`
  614.   }
  615.   
  616. > int BN_set_bit(BIGNUM *a, int n)
  617.   {
  618.       int i, j, k;

crypto/bn/bn_mont.c:329:14: Call
327.           tmod.top = buf[0] != 0 ? 1 : 0;
328.           /* Ri = R^-1 mod N */
329.           if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
                    ^
330.               goto err;
331.           if (!BN_lshift(Ri, Ri, BN_BITS2))

crypto/bn/bn_gcd.c:124:1: Parameter `a->top`
  122.                                           BN_CTX *ctx);
  123.   
  124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
  125.                          const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
  126.   {

crypto/bn/bn_gcd.c:129:10: Call
  127.       BIGNUM *rv;
  128.       int noinv;
  129.       rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
                  ^
  130.       if (noinv)
  131.           BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);

crypto/bn/bn_gcd.c:135:1: Parameter `a->top`
    133.   }
    134.   
    135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
    136.                              const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
    137.                              int *pnoinv)

crypto/bn/bn_mont.c:372:5: Call
370.   
371.       /* setup RR for conversions */
372.       BN_zero(&(mont->RR));
           ^
373.       if (!BN_set_bit(&(mont->RR), mont->ri * 2))
374.           goto err;

crypto/bn/bn_lib.c:394:15: Assignment
  392.       a->neg = 0;
  393.       a->d[0] = w;
  394.       a->top = (w ? 1 : 0);
                       ^
  395.       bn_check_top(a);
  396.       return 1;

crypto/bn/bn_lib.c:394:5: Assignment
  392.       a->neg = 0;
  393.       a->d[0] = w;
  394.       a->top = (w ? 1 : 0);
             ^
  395.       bn_check_top(a);
  396.       return 1;

crypto/bn/bn_mont.c:373:10: Call
371.       /* setup RR for conversions */
372.       BN_zero(&(mont->RR));
373.       if (!BN_set_bit(&(mont->RR), mont->ri * 2))
                ^
374.           goto err;
375.       if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx))

crypto/bn/bn_lib.c:616:1: Parameter `a->top`
  614.   }
  615.   
  616. > int BN_set_bit(BIGNUM *a, int n)
  617.   {
  618.       int i, j, k;

crypto/bn/bn_mont.c:375:10: Call
373.       if (!BN_set_bit(&(mont->RR), mont->ri * 2))
374.           goto err;
375.       if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx))
                ^
376.           goto err;
377.   

crypto/bn/bn_div.c:137:1: Parameter `rm->top`
  135.    * If 'dv' or 'rm' is NULL, the respective value is not returned.
  136.    */
  137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
  138.              BN_CTX *ctx)
  139.   {

crypto/bn/bn_div.c:182:17: Call
  180.       if (!no_branch && BN_ucmp(num, divisor) < 0) {
  181.           if (rm != NULL) {
  182.               if (BN_copy(rm, num) == NULL)
                         ^
  183.                   return 0;
  184.           }

crypto/bn/bn_lib.c:312:1: Parameter `a->top`
    310.   }
    311.   
    312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
    313.   {
    314.       bn_check_top(b);

crypto/bn/bn_lib.c:318:9: Call
    316.       if (a == b)
    317.           return a;
    318.       if (bn_wexpand(a, b->top) == NULL)
                   ^
    319.           return NULL;
    320.   

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

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

crypto/bn/bn_lib.c:273:1: Parameter `b->top`
        271.    */
        272.   
        273. > BIGNUM *bn_expand2(BIGNUM *b, int words)
        274.   {
        275.       bn_check_top(b);

crypto/bn/bn_lib.c:278:23: Call
        276.   
        277.       if (words > b->dmax) {
        278.           BN_ULONG *a = bn_expand_internal(b, words);
                                     ^
        279.           if (!a)
        280.               return NULL;

crypto/bn/bn_lib.c:235:1: <Offset trace>
233.   /* This is used by bn_expand2() */
234.   /* The caller MUST check that words > b->dmax before calling this */
235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
236.   {
237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:235:1: Parameter `b->top`
          233.   /* This is used by bn_expand2() */
          234.   /* The caller MUST check that words > b->dmax before calling this */
          235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
          236.   {
          237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:235:1: <Length trace>
233.   /* This is used by bn_expand2() */
234.   /* The caller MUST check that words > b->dmax before calling this */
235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
236.   {
237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:235:1: Parameter `words`
          233.   /* This is used by bn_expand2() */
          234.   /* The caller MUST check that words > b->dmax before calling this */
          235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
          236.   {
          237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:252:13: Call
          250.           a = OPENSSL_secure_zalloc(words * sizeof(*a));
          251.       else
          252.           a = OPENSSL_zalloc(words * sizeof(*a));
                             ^
          253.       if (a == NULL) {
          254.           BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);

crypto/mem.c:218:1: Parameter `num`
            216.   }
            217.   
            218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
            219.   {
            220.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:220:17: Call
            218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
            219.   {
            220.       void *ret = CRYPTO_malloc(num, file, line);
                                   ^
            221.   
            222.       FAILTEST();

crypto/mem.c:198:9: Assignment
              196.   
              197.       if (num == 0)
              198.           return NULL;
                             ^
              199.   
              200.       FAILTEST();

crypto/mem.c:220:5: Assignment
            218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
            219.   {
            220.       void *ret = CRYPTO_malloc(num, file, line);
                       ^
            221.   
            222.       FAILTEST();

crypto/mem.c:225:5: Assignment
            223.       if (ret != NULL)
            224.           memset(ret, 0, num);
            225.       return ret;
                       ^
            226.   }
            227.   

crypto/bn/bn_lib.c:252:9: Assignment
          250.           a = OPENSSL_secure_zalloc(words * sizeof(*a));
          251.       else
          252.           a = OPENSSL_zalloc(words * sizeof(*a));
                         ^
          253.       if (a == NULL) {
          254.           BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:260:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_div` 
          258.       assert(b->top <= words);
          259.       if (b->top > 0)
          260.           memcpy(a, b->d, sizeof(*a) * b->top);
                         ^
          261.   
          262.       return a;
