crypto/srp/srp_vfy.c:625: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 619 could be null and is dereferenced by call to `BN_mod_exp()` at line 625, column 10.
Showing all 54 steps of the trace


crypto/srp/srp_vfy.c:597:1: start of procedure SRP_create_verifier_BN()
595.    * create a verifier (*salt,*verifier,g and N are BIGNUMs)
596.    */
597. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
598.                              BIGNUM **verifier, const BIGNUM *N,
599.                              const BIGNUM *g)

crypto/srp/srp_vfy.c:601:5: 
599.                              const BIGNUM *g)
600.   {
601. >     int result = 0;
602.       BIGNUM *x = NULL;
603.       BN_CTX *bn_ctx = BN_CTX_new();

crypto/srp/srp_vfy.c:602:5: 
600.   {
601.       int result = 0;
602. >     BIGNUM *x = NULL;
603.       BN_CTX *bn_ctx = BN_CTX_new();
604.       unsigned char tmp2[MAX_LEN];

crypto/srp/srp_vfy.c:603:5: Skipping BN_CTX_new(): empty list of specs
601.       int result = 0;
602.       BIGNUM *x = NULL;
603.       BN_CTX *bn_ctx = BN_CTX_new();
           ^
604.       unsigned char tmp2[MAX_LEN];
605.   

crypto/srp/srp_vfy.c:606:10: Taking false branch
604.       unsigned char tmp2[MAX_LEN];
605.   
606.       if ((user == NULL) ||
                ^
607.           (pass == NULL) ||
608.           (salt == NULL) ||

crypto/srp/srp_vfy.c:607:10: Taking false branch
605.   
606.       if ((user == NULL) ||
607.           (pass == NULL) ||
                ^
608.           (salt == NULL) ||
609.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))

crypto/srp/srp_vfy.c:608:10: Taking false branch
606.       if ((user == NULL) ||
607.           (pass == NULL) ||
608.           (salt == NULL) ||
                ^
609.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
610.           goto err;

crypto/srp/srp_vfy.c:609:10: Taking false branch
607.           (pass == NULL) ||
608.           (salt == NULL) ||
609.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                ^
610.           goto err;
611.   

crypto/srp/srp_vfy.c:609:32: Taking false branch
607.           (pass == NULL) ||
608.           (salt == NULL) ||
609.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                                      ^
610.           goto err;
611.   

crypto/srp/srp_vfy.c:609:47: Taking false branch
607.           (pass == NULL) ||
608.           (salt == NULL) ||
609.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                                                     ^
610.           goto err;
611.   

crypto/srp/srp_vfy.c:609:62: Taking false branch
607.           (pass == NULL) ||
608.           (salt == NULL) ||
609.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                                                                    ^
610.           goto err;
611.   

crypto/srp/srp_vfy.c:612:9: Taking false branch
610.           goto err;
611.   
612.       if (*salt == NULL) {
               ^
613.           if (RAND_bytes(tmp2, SRP_RANDOM_SALT_LEN) <= 0)
614.               goto err;

crypto/srp/srp_vfy.c:619:5: 
617.       }
618.   
619. >     x = SRP_Calc_x(*salt, user, pass);
620.   
621.       *verifier = BN_new();

crypto/srp/srp_lib.c:196:1: start of procedure SRP_Calc_x()
  194.   }
  195.   
  196. > BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass)
  197.   {
  198.       unsigned char dig[SHA_DIGEST_LENGTH];

crypto/srp/srp_lib.c:202:10: Taking false branch
  200.       unsigned char *cs;
  201.   
  202.       if ((s == NULL) || (user == NULL) || (pass == NULL))
                  ^
  203.           return NULL;
  204.   

crypto/srp/srp_lib.c:202:25: Taking false branch
  200.       unsigned char *cs;
  201.   
  202.       if ((s == NULL) || (user == NULL) || (pass == NULL))
                                 ^
  203.           return NULL;
  204.   

crypto/srp/srp_lib.c:202:43: Taking false branch
  200.       unsigned char *cs;
  201.   
  202.       if ((s == NULL) || (user == NULL) || (pass == NULL))
                                                   ^
  203.           return NULL;
  204.   

crypto/srp/srp_lib.c:205:9: 
  203.           return NULL;
  204.   
  205. >     if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL)
  206.           return NULL;
  207.   

crypto/bn/bn_lib.c:214:1: start of procedure BN_num_bits()
    212.   }
    213.   
    214. > int BN_num_bits(const BIGNUM *a)
    215.   {
    216.       int i = a->top - 1;

crypto/bn/bn_lib.c:216:5: 
    214.   int BN_num_bits(const BIGNUM *a)
    215.   {
    216. >     int i = a->top - 1;
    217.       bn_check_top(a);
    218.   

crypto/bn/bn_lib.c:219:9: 
    217.       bn_check_top(a);
    218.   
    219. >     if (BN_is_zero(a))
    220.           return 0;
    221.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:897:1: start of procedure BN_is_zero()
      895.   }
      896.   
      897. > int BN_is_zero(const BIGNUM *a)
      898.   {
      899.       return a->top == 0;

crypto/bn/bn_lib.c:899:12: Condition is true
      897.   int BN_is_zero(const BIGNUM *a)
      898.   {
      899.       return a->top == 0;
                        ^
      900.   }
      901.   

crypto/bn/bn_lib.c:899:5: 
      897.   int BN_is_zero(const BIGNUM *a)
      898.   {
      899. >     return a->top == 0;
      900.   }
      901.   

crypto/bn/bn_lib.c:900:1: return from a call to BN_is_zero
      898.   {
      899.       return a->top == 0;
      900. > }
      901.   
      902.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:219:9: Taking true branch
    217.       bn_check_top(a);
    218.   
    219.       if (BN_is_zero(a))
                   ^
    220.           return 0;
    221.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:220:9: 
    218.   
    219.       if (BN_is_zero(a))
    220. >         return 0;
    221.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    222.   }

crypto/bn/bn_lib.c:222:1: return from a call to BN_num_bits
    220.           return 0;
    221.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    222. > }
    223.   
    224.   static void bn_free_d(BIGNUM *a)

crypto/mem.c:398:1: start of procedure CRYPTO_malloc()
    396.   }
    397.   
    398. > void *CRYPTO_malloc(int num, const char *file, int line)
    399.   {
    400.       void *ret = NULL;

crypto/mem.c:400:5: 
    398.   void *CRYPTO_malloc(int num, const char *file, int line)
    399.   {
    400. >     void *ret = NULL;
    401.   
    402.       if (num <= 0)

crypto/mem.c:402:9: Taking true branch
    400.       void *ret = NULL;
    401.   
    402.       if (num <= 0)
                   ^
    403.           return NULL;
    404.   

crypto/mem.c:403:9: 
    401.   
    402.       if (num <= 0)
    403. >         return NULL;
    404.   
    405.       if (allow_customize)

crypto/mem.c:432:1: return from a call to CRYPTO_malloc
    430.   
    431.       return ret;
    432. > }
    433.   
    434.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/srp/srp_lib.c:205:9: Taking true branch
  203.           return NULL;
  204.   
  205.       if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL)
                 ^
  206.           return NULL;
  207.   

crypto/srp/srp_lib.c:206:9: 
  204.   
  205.       if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL)
  206. >         return NULL;
  207.   
  208.       EVP_MD_CTX_init(&ctxt);

crypto/srp/srp_lib.c:224:1: return from a call to SRP_Calc_x
  222.   
  223.       return BN_bin2bn(dig, sizeof(dig), NULL);
  224. > }
  225.   
  226.   BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g)

crypto/srp/srp_vfy.c:621:5: Skipping BN_new(): empty list of specs
619.       x = SRP_Calc_x(*salt, user, pass);
620.   
621.       *verifier = BN_new();
           ^
622.       if (*verifier == NULL)
623.           goto err;

crypto/srp/srp_vfy.c:622:9: Taking false branch
620.   
621.       *verifier = BN_new();
622.       if (*verifier == NULL)
               ^
623.           goto err;
624.   

crypto/srp/srp_vfy.c:625:10: 
623.           goto err;
624.   
625. >     if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
626.           BN_clear_free(*verifier);
627.           goto err;

crypto/bn/bn_exp.c:191:1: start of procedure BN_mod_exp()
  189.   }
  190.   
  191. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
  192.                  BN_CTX *ctx)
  193.   {

crypto/bn/bn_exp.c:243:9: 
  241.       /* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */
  242.   
  243. >     if (BN_is_odd(m)) {
  244.   # ifdef MONT_EXP_WORD
  245.           if (a->top == 1 && !a->neg

crypto/bn/bn_lib.c:912:1: start of procedure BN_is_odd()
    910.   }
    911.   
    912. > int BN_is_odd(const BIGNUM *a)
    913.   {
    914.       return (a->top > 0) && (a->d[0] & 1);

crypto/bn/bn_lib.c:914:13: Condition is false
    912.   int BN_is_odd(const BIGNUM *a)
    913.   {
    914.       return (a->top > 0) && (a->d[0] & 1);
                       ^
    915.   }
    916.   

crypto/bn/bn_lib.c:914:12: 
    912.   int BN_is_odd(const BIGNUM *a)
    913.   {
    914. >     return (a->top > 0) && (a->d[0] & 1);
    915.   }
    916.   

crypto/bn/bn_lib.c:914:5: 
    912.   int BN_is_odd(const BIGNUM *a)
    913.   {
    914. >     return (a->top > 0) && (a->d[0] & 1);
    915.   }
    916.   

crypto/bn/bn_lib.c:915:1: return from a call to BN_is_odd
    913.   {
    914.       return (a->top > 0) && (a->d[0] & 1);
    915. > }
    916.   
    917.   int BN_is_negative(const BIGNUM *a)

crypto/bn/bn_exp.c:243:9: Taking false branch
  241.       /* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */
  242.   
  243.       if (BN_is_odd(m)) {
                 ^
  244.   # ifdef MONT_EXP_WORD
  245.           if (a->top == 1 && !a->neg

crypto/bn/bn_exp.c:256:9: 
  254.   #ifdef RECP_MUL_MOD
  255.       {
  256. >         ret = BN_mod_exp_recp(r, a, p, m, ctx);
  257.       }
  258.   #else

crypto/bn/bn_exp.c:268:1: start of procedure BN_mod_exp_recp()
    266.   }
    267.   
    268. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
    269.                       const BIGNUM *m, BN_CTX *ctx)
    270.   {

crypto/bn/bn_exp.c:271:5: 
    269.                       const BIGNUM *m, BN_CTX *ctx)
    270.   {
    271. >     int i, j, bits, ret = 0, wstart, wend, window, wvalue;
    272.       int start = 1;
    273.       BIGNUM *aa;

crypto/bn/bn_exp.c:272:5: 
    270.   {
    271.       int i, j, bits, ret = 0, wstart, wend, window, wvalue;
    272. >     int start = 1;
    273.       BIGNUM *aa;
    274.       /* Table of variables obtained from 'ctx' */

crypto/bn/bn_exp.c:278:9: 
    276.       BN_RECP_CTX recp;
    277.   
    278. >     if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
    279.           /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
    280.           BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);

crypto/bn/bn_lib.c:963:1: start of procedure BN_get_flags()
      961.   }
      962.   
      963. > int BN_get_flags(const BIGNUM *b, int n)
      964.   {
      965.       return b->flags & n;

crypto/bn/bn_lib.c:965:5: 
      963.   int BN_get_flags(const BIGNUM *b, int n)
      964.   {
      965. >     return b->flags & n;
      966.   }
      967.   
