crypto/bn/bn_exp.c:1059: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_mul_montgomery`.
Showing all 27 steps of the trace


crypto/bn/bn_exp.c:747:14: Assignment
745.           /* 2^(top*BN_BITS2) - m */
746.           tmp.d[0] = (0 - m->d[0]) & BN_MASK2;
747.           for (i = 1; i < top; i++)
                    ^
748.               tmp.d[i] = (~m->d[i]) & BN_MASK2;
749.           tmp.top = top;

crypto/bn/bn_exp.c:1046:14: Call
1044.           for (wvalue = 0, i = bits % window; i >= 0; i--, bits--)
1045.               wvalue = (wvalue << 1) + BN_is_bit_set(p, bits);
1046.           if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
                     ^
1047.                                               window))
1048.               goto err;

crypto/bn/bn_exp.c:522:1: Parameter `top`
  520.   }
  521.   
  522. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
  523.                                             unsigned char *buf, int idx,
  524.                                             int window)

crypto/bn/bn_exp.c:579:5: Assignment
  577.       }
  578.   
  579.       b->top = top;
             ^
  580.       bn_correct_top(b);
  581.       return 1;

crypto/bn/bn_exp.c:580:5: Call
  578.   
  579.       b->top = top;
  580.       bn_correct_top(b);
             ^
  581.       return 1;
  582.   }

crypto/bn/bn_lib.c:915:1: Parameter `a->top`
    913.   }
    914.   
    915. > void bn_correct_top(BIGNUM *a)
    916.   {
    917.       BN_ULONG *ftl;

crypto/bn/bn_exp.c:1059:22: Call
1057.               /* Scan the window, squaring the result as we go */
1058.               for (i = 0; i < window; i++, bits--) {
1059.                   if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx))
                             ^
1060.                       goto err;
1061.                   wvalue = (wvalue << 1) + BN_is_bit_set(p, bits);

crypto/bn/bn_mont.c:26:1: Parameter `r->top`
  24.   #endif
  25.   
  26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  27.                             BN_MONT_CTX *mont, BN_CTX *ctx)
  28.   {

crypto/bn/bn_mont.c:61:10: Call
  59.       /* reduce from aRR to aR */
  60.   #ifdef MONT_WORD
  61.       if (!BN_from_montgomery_word(r, tmp, mont))
                 ^
  62.           goto err;
  63.   #else

crypto/bn/bn_mont.c:75:1: Parameter `ret->top`
    73.   
    74.   #ifdef MONT_WORD
    75. > static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
    76.   {
    77.       BIGNUM *n;

crypto/bn/bn_mont.c:117:9: Call
    115.       }
    116.   
    117.       if (bn_wexpand(ret, nl) == NULL)
                   ^
    118.           return 0;
    119.       ret->top = nl;

crypto/bn/bn_lib.c:910:1: Parameter `a->top`
      908.   }
      909.   
      910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
      911.   {
      912.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:912:37: Call
      910.   BIGNUM *bn_wexpand(BIGNUM *a, int words)
      911.   {
      912.       return (words <= a->dmax) ? a : bn_expand2(a, words);
                                                 ^
      913.   }
      914.   

crypto/bn/bn_lib.c:246:1: Parameter `b->top`
        244.    */
        245.   
        246. > BIGNUM *bn_expand2(BIGNUM *b, int words)
        247.   {
        248.       bn_check_top(b);

crypto/bn/bn_lib.c:251:23: Call
        249.   
        250.       if (words > b->dmax) {
        251.           BN_ULONG *a = bn_expand_internal(b, words);
                                     ^
        252.           if (!a)
        253.               return NULL;

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

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

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

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

crypto/bn/bn_lib.c:225:13: Call
          223.           a = OPENSSL_secure_zalloc(words * sizeof(*a));
          224.       else
          225.           a = OPENSSL_zalloc(words * sizeof(*a));
                             ^
          226.       if (a == NULL) {
          227.           BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);

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

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

crypto/mem.c:201:9: Assignment
              199.   
              200.       if (num == 0)
              201.           return NULL;
                             ^
              202.   
              203.       FAILTEST();

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

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

crypto/bn/bn_lib.c:225:9: Assignment
          223.           a = OPENSSL_secure_zalloc(words * sizeof(*a));
          224.       else
          225.           a = OPENSSL_zalloc(words * sizeof(*a));
                         ^
          226.       if (a == NULL) {
          227.           BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_mul_montgomery` 
          231.       assert(b->top <= words);
          232.       if (b->top > 0)
          233.           memcpy(a, b->d, sizeof(*a) * b->top);
                         ^
          234.   
          235.       return a;
