crypto/sm2/sm2_sign.c:334: error: BUFFER_OVERRUN_L3
  Offset: 0 Size: [0, 8388607] by call to `BN_mod_add`.
Showing all 15 steps of the trace


crypto/sm2/sm2_sign.c:307:9: Call
305.   
306.       BN_CTX_start(ctx);
307.       t = BN_CTX_get(ctx);
               ^
308.       x1 = BN_CTX_get(ctx);
309.       if (x1 == NULL) {

crypto/bn/bn_ctx.c:229:5: Call
  227.       }
  228.       /* OK, make sure the returned bignum is "zero" */
  229.       BN_zero(ret);
             ^
  230.       ctx->used++;
  231.       CTXDBG_RET(ctx, ret);

crypto/bn/bn_lib.c:359:1: Parameter `*a->d`
    357.   }
    358.   
    359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
    360.   {
    361.       bn_check_top(a);

crypto/bn/bn_lib.c:362:9: Call
    360.   {
    361.       bn_check_top(a);
    362.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                   ^
    363.           return 0;
    364.       a->neg = 0;

crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
      658.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
      659.   
      660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
      661.   {
      662.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/sm2/sm2_sign.c:334:10: Call
332.       }
333.   
334.       if (!BN_mod_add(t, r, s, order, ctx)) {
                ^
335.           SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_BN_LIB);
336.           goto done;

crypto/bn/bn_mod.c:28:1: Parameter `*r->d`
  26.   }
  27.   
  28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
  29.                  BN_CTX *ctx)
  30.   {

crypto/bn/bn_mod.c:31:10: Call
  29.                  BN_CTX *ctx)
  30.   {
  31.       if (!BN_add(r, a, b))
                 ^
  32.           return 0;
  33.       return BN_nnmod(r, r, m, ctx);

crypto/bn/bn_add.c:14:1: Parameter `*r->d`
    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/bn/bn_add.c:34:13: Call
    32.           } else {
    33.               r_neg = 0;
    34.               BN_zero(r);
                      ^
    35.               ret = 1;
    36.           }

crypto/bn/bn_lib.c:359:1: <Length trace>
357.   }
358.   
359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
360.   {
361.       bn_check_top(a);

crypto/bn/bn_lib.c:359:1: Parameter `*a->d`
      357.   }
      358.   
      359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
      360.   {
      361.       bn_check_top(a);

crypto/bn/bn_lib.c:362:9: Call
      360.   {
      361.       bn_check_top(a);
      362.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                     ^
      363.           return 0;
      364.       a->neg = 0;

crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
        658.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
        659.   
        660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
        661.   {
        662.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/bn/bn_lib.c:365:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_mod_add` 
      363.           return 0;
      364.       a->neg = 0;
      365.       a->d[0] = w;
                 ^
      366.       a->top = (w ? 1 : 0);
      367.       a->flags &= ~BN_FLG_FIXED_TOP;
