crypto/sm2/sm2_sign.c:108: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`.
Showing all 26 steps of the trace


crypto/sm2/sm2_sign.c:102:13: Call
100.           BN_priv_rand_range(k, order);
101.   
102.           if (EC_POINT_mul(group, kG, k, NULL, NULL, ctx) == 0)
                   ^
103.               goto done;
104.   

crypto/ec/ec_lib.c:932:12: Call
  930.       scalars[0] = p_scalar;
  931.   
  932.       return EC_POINTs_mul(group, r, g_scalar,
                    ^
  933.                            (point != NULL
  934.                             && p_scalar != NULL), points, scalars, ctx);

crypto/ec/ec_lib.c:910:1: Parameter `(*scalars)->top`
    908.    */
    909.   
    910. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
    911.                     size_t num, const EC_POINT *points[],
    912.                     const BIGNUM *scalars[], BN_CTX *ctx)

crypto/sm2/sm2_sign.c:108:13: Call
106.               goto done;
107.   
108.           if (BN_mod_add(r, e, x1, order, ctx) == 0)
                   ^
109.               goto done;
110.   

crypto/bn/bn_mod.c:28:1: Parameter `r->top`
  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->top`
    12.   
    13.   /* r can == a or b */
    14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
    15.   {
    16.       int a_neg = a->neg, ret;

crypto/bn/bn_add.c:51:11: Call
    49.       }
    50.   
    51.       ret = BN_uadd(r, a, b);
                    ^
    52.       r->neg = a_neg;
    53.       bn_check_top(r);

crypto/bn/bn_add.c:58:1: Parameter `r->top`
      56.   
      57.   /* unsigned add of b to a */
      58. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
      59.   {
      60.       int max, min, dif;

crypto/bn/bn_add.c:78:9: Call
      76.       dif = max - min;
      77.   
      78.       if (bn_wexpand(r, max + 1) == NULL)
                    ^
      79.           return 0;
      80.   

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:228:1: Parameter `num`
              226.   }
              227.   
              228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
              229.   {
              230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:17: Call
              228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
              229.   {
              230.       void *ret = CRYPTO_malloc(num, file, line);
                                     ^
              231.   
              232.       FAILTEST();

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

crypto/mem.c:230:5: Assignment
              228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
              229.   {
              230.       void *ret = CRYPTO_malloc(num, file, line);
                         ^
              231.   
              232.       FAILTEST();

crypto/mem.c:235:5: Assignment
              233.       if (ret != NULL)
              234.           memset(ret, 0, num);
              235.       return ret;
                         ^
              236.   }
              237.   

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_add` 
            231.       assert(b->top <= words);
            232.       if (b->top > 0)
            233.           memcpy(a, b->d, sizeof(*a) * b->top);
                           ^
            234.   
            235.       return a;
