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


crypto/bn/bn_exp.c:737:14: Assignment
735.           /* 2^(top*BN_BITS2) - m */
736.           tmp.d[0] = (0 - m->d[0]) & BN_MASK2;
737.           for (i = 1; i < top; i++)
                    ^
738.               tmp.d[i] = (~m->d[i]) & BN_MASK2;
739.           tmp.top = top;

crypto/bn/bn_exp.c:1036:14: Call
1034.           for (wvalue = 0, i = bits % window; i >= 0; i--, bits--)
1035.               wvalue = (wvalue << 1) + BN_is_bit_set(p, bits);
1036.           if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
                     ^
1037.                                               window))
1038.               goto err;

crypto/bn/bn_exp.c:518:1: Parameter `top`
  516.   }
  517.   
  518. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
  519.                                             unsigned char *buf, int idx,
  520.                                             int window)

crypto/bn/bn_exp.c:575:5: Assignment
  573.       }
  574.   
  575.       b->top = top;
             ^
  576.       bn_correct_top(b);
  577.       return 1;

crypto/bn/bn_exp.c:576:5: Call
  574.   
  575.       b->top = top;
  576.       bn_correct_top(b);
             ^
  577.       return 1;
  578.   }

crypto/bn/bn_lib.c:953:1: Parameter `a->top`
    951.   }
    952.   
    953. > void bn_correct_top(BIGNUM *a)
    954.   {
    955.       BN_ULONG *ftl;

crypto/bn/bn_exp.c:1062:18: Call
1060.   
1061.               /* Multiply the result into the intermediate result */
1062.               if (!BN_mod_mul_montgomery(&tmp, &tmp, &am, mont, ctx))
                         ^
1063.                   goto err;
1064.           }

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:35:13: Call
  33.   
  34.       if (num > 1 && a->top == num && b->top == num) {
  35.           if (bn_wexpand(r, num) == NULL)
                    ^
  36.               return (0);
  37.           if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {

crypto/bn/bn_lib.c:948:1: Parameter `a->top`
    946.   }
    947.   
    948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
    949.   {
    950.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:950:37: Call
    948.   BIGNUM *bn_wexpand(BIGNUM *a, int words)
    949.   {
    950.       return (words <= a->dmax) ? a : bn_expand2(a, words);
                                               ^
    951.   }
    952.   

crypto/bn/bn_lib.c:284:1: Parameter `b->top`
      282.    */
      283.   
      284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
      285.   {
      286.       bn_check_top(b);

crypto/bn/bn_lib.c:289:23: Call
      287.   
      288.       if (words > b->dmax) {
      289.           BN_ULONG *a = bn_expand_internal(b, words);
                                   ^
      290.           if (!a)
      291.               return NULL;

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

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

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

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

crypto/bn/bn_lib.c:263:13: Call
        261.           a = OPENSSL_secure_zalloc(words * sizeof(*a));
        262.       else
        263.           a = OPENSSL_zalloc(words * sizeof(*a));
                           ^
        264.       if (a == NULL) {
        265.           BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);

crypto/mem.c:186:1: Parameter `num`
          184.   }
          185.   
          186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
          187.   {
          188.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:188:17: Call
          186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
          187.   {
          188.       void *ret = CRYPTO_malloc(num, file, line);
                                 ^
          189.   
          190.       FAILTEST();

crypto/mem.c:166:9: Assignment
            164.   
            165.       if (num == 0)
            166.           return NULL;
                           ^
            167.   
            168.       FAILTEST();

crypto/mem.c:188:5: Assignment
          186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
          187.   {
          188.       void *ret = CRYPTO_malloc(num, file, line);
                     ^
          189.   
          190.       FAILTEST();

crypto/mem.c:193:5: Assignment
          191.       if (ret != NULL)
          192.           memset(ret, 0, num);
          193.       return ret;
                     ^
          194.   }
          195.   

crypto/bn/bn_lib.c:263:9: Assignment
        261.           a = OPENSSL_secure_zalloc(words * sizeof(*a));
        262.       else
        263.           a = OPENSSL_zalloc(words * sizeof(*a));
                       ^
        264.       if (a == NULL) {
        265.           BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);

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