crypto/dsa/dsa_ossl.c:274: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 67108856] by call to `dsa_mod_inverse_fermat`.
Showing all 39 steps of the trace


crypto/dsa/dsa_ossl.c:178:1: Parameter `dsa->q->top`
176.   }
177.   
178. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
179.                             BIGNUM **kinvp, BIGNUM **rp,
180.                             const unsigned char *dgst, int dlen)

crypto/dsa/dsa_ossl.c:194:31: Call
192.   
193.       /* Reject obviously invalid parameters */
194.       if (BN_is_zero(dsa->p) || BN_is_zero(dsa->q) || BN_is_zero(dsa->g)) {
                                     ^
195.           DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_INVALID_PARAMETERS);
196.           return 0;

crypto/bn/bn_lib.c:866:1: Parameter `a->top`
  864.   }
  865.   
  866. > int BN_is_zero(const BIGNUM *a)
  867.   {
  868.       return a->top == 0;

crypto/dsa/dsa_ossl.c:211:14: Call
209.   
210.       /* Preallocate space */
211.       q_bits = BN_num_bits(dsa->q);
                    ^
212.       q_words = bn_get_top(dsa->q);
213.       if (!bn_wexpand(k, q_words + 2)

crypto/bn/bn_lib.c:140:9: Call
  138.       bn_check_top(a);
  139.   
  140.       if (BN_is_zero(a))
                 ^
  141.           return 0;
  142.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:866:1: Parameter `a->top`
    864.   }
    865.   
    866. > int BN_is_zero(const BIGNUM *a)
    867.   {
    868.       return a->top == 0;

crypto/dsa/dsa_ossl.c:227:21: Call
225.                                          dlen, ctx))
226.                   goto err;
227.           } else if (!BN_priv_rand_range(k, dsa->q))
                           ^
228.               goto err;
229.       } while (BN_is_zero(k));

crypto/bn/bn_rand.c:208:1: Parameter `range->top`
  206.   }
  207.   
  208. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
  209.   {
  210.       return bnrand_range(PRIVATE, r, range, NULL);

crypto/bn/bn_rand.c:210:12: Call
  208.   int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
  209.   {
  210.       return bnrand_range(PRIVATE, r, range, NULL);
                    ^
  211.   }
  212.   

crypto/bn/bn_rand.c:127:1: Parameter `range->top`
    125.   
    126.   /* random number r:  0 <= r < range */
    127. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range,
    128.                           BN_CTX *ctx)
    129.   {

crypto/dsa/dsa_ossl.c:255:10: Call
253.        * The fix is to rework BN so these gymnastics aren't required.
254.        */
255.       if (!BN_add(l, k, dsa->q)
                ^
256.           || !BN_add(k, l, dsa->q))
257.           goto err;

crypto/bn/bn_add.c:14:1: Parameter `b->top`
  12.   
  13.   /* signed add of b to a. */
  14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  15.   {
  16.       int ret, r_neg, cmp_res;

crypto/dsa/dsa_ossl.c:256:13: Call
254.        */
255.       if (!BN_add(l, k, dsa->q)
256.           || !BN_add(k, l, dsa->q))
                   ^
257.           goto err;
258.   

crypto/bn/bn_add.c:14:1: Parameter `b->top`
  12.   
  13.   /* signed add of b to a. */
  14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  15.   {
  16.       int ret, r_neg, cmp_res;

crypto/dsa/dsa_ossl.c:270:10: Call
268.       }
269.   
270.       if (!BN_mod(r, r, dsa->q, ctx))
                ^
271.           goto err;
272.   

crypto/bn/bn_div.c:214:9: Call
  212.       int ret;
  213.   
  214.       if (BN_is_zero(divisor)) {
                 ^
  215.           BNerr(BN_F_BN_DIV, BN_R_DIV_BY_ZERO);
  216.           return 0;

crypto/bn/bn_lib.c:866:1: Parameter `a->top`
    864.   }
    865.   
    866. > int BN_is_zero(const BIGNUM *a)
    867.   {
    868.       return a->top == 0;

crypto/dsa/dsa_ossl.c:274:17: Call
272.   
273.       /* Compute part of 's = inv(k) (m + xr) mod q' */
274.       if ((kinv = dsa_mod_inverse_fermat(k, dsa->q, ctx)) == NULL)
                       ^
275.           goto err;
276.   

crypto/dsa/dsa_ossl.c:415:1: Parameter `q->top`
  413.    * BIGNUM is returned which the caller must free.
  414.    */
  415. > static BIGNUM *dsa_mod_inverse_fermat(const BIGNUM *k, const BIGNUM *q,
  416.                                         BN_CTX *ctx)
  417.   {

crypto/dsa/dsa_ossl.c:427:16: Call
  425.       if ((e = BN_CTX_get(ctx)) != NULL
  426.               && BN_set_word(r, 2)
  427.               && BN_sub(e, q, r)
                        ^
  428.               && BN_mod_exp_mont(r, k, e, q, ctx, NULL))
  429.           res = r;

crypto/bn/bn_add.c:45:1: Parameter `a->top`
    43.   
    44.   /* signed sub of b from a. */
    45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
    46.   {
    47.       int ret, r_neg, cmp_res;

crypto/dsa/dsa_ossl.c:428:16: Call
  426.               && BN_set_word(r, 2)
  427.               && BN_sub(e, q, r)
  428.               && BN_mod_exp_mont(r, k, e, q, ctx, NULL))
                        ^
  429.           res = r;
  430.       else

crypto/bn/bn_exp.c:296:1: Parameter `m->top`
    294.   }
    295.   
    296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
    297.                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
    298.   {

crypto/bn/bn_exp.c:310:16: Call
    308.               || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
    309.               || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
    310.           return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
                          ^
    311.       }
    312.   

crypto/bn/bn_exp.c:592:1: Parameter `m->top`
      590.    * http://www.daemonology.net/hyperthreading-considered-harmful/)
      591.    */
      592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
      593.                                 const BIGNUM *m, BN_CTX *ctx,
      594.                                 BN_MONT_CTX *in_mont)

crypto/bn/bn_exp.c:613:10: Call
      611.       bn_check_top(m);
      612.   
      613.       if (!BN_is_odd(m)) {
                      ^
      614.           BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
      615.           return 0;

crypto/bn/bn_lib.c:881:1: Parameter `a->top`
        879.   }
        880.   
        881. > int BN_is_odd(const BIGNUM *a)
        882.   {
        883.       return (a->top > 0) && (a->d[0] & 1);

crypto/bn/bn_exp.c:647:14: Call
      645.           if ((mont = BN_MONT_CTX_new()) == NULL)
      646.               goto err;
      647.           if (!BN_MONT_CTX_set(mont, m, ctx))
                          ^
      648.               goto err;
      649.       }

crypto/bn/bn_mont.c:263:1: Parameter `mod->top`
        261.   }
        262.   
        263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
        264.   {
        265.       int i, ret = 0;

crypto/bn/bn_mont.c:268:9: Call
        266.       BIGNUM *Ri, *R;
        267.   
        268.       if (BN_is_zero(mod))
                       ^
        269.           return 0;
        270.   

crypto/bn/bn_lib.c:866:1: Parameter `a->top`
          864.   }
          865.   
          866. > int BN_is_zero(const BIGNUM *a)
          867.   {
          868.       return a->top == 0;

crypto/bn/bn_mont.c:275:10: Call
        273.           goto err;
        274.       R = &(mont->RR);            /* grab RR as a temp */
        275.       if (!BN_copy(&(mont->N), mod))
                        ^
        276.           goto err;               /* Set N */
        277.       if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)

crypto/bn/bn_lib.c:281:1: <Offset trace>
279.   }
280.   
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282.   {
283.       bn_check_top(b);

crypto/bn/bn_lib.c:281:1: Parameter `b->top`
          279.   }
          280.   
          281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
          282.   {
          283.       bn_check_top(b);

crypto/bn/bn_lib.c:281:1: <Length trace>
279.   }
280.   
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282.   {
283.       bn_check_top(b);

crypto/bn/bn_lib.c:281:1: Parameter `*a->d`
          279.   }
          280.   
          281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
          282.   {
          283.       bn_check_top(b);

crypto/bn/bn_lib.c:287:9: Call
          285.       if (a == b)
          286.           return a;
          287.       if (bn_wexpand(a, b->top) == NULL)
                         ^
          288.           return NULL;
          289.   

crypto/bn/bn_lib.c:962:1: Parameter `*a->d`
            960.   }
            961.   
            962. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
            963.   {
            964.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `dsa_mod_inverse_fermat` 
          289.   
          290.       if (b->top > 0)
          291.           memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
                         ^
          292.   
          293.       a->neg = b->neg;
