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


crypto/srp/srp_vfy.c:607:1: start of procedure SRP_create_verifier_BN()
605.    * BIGNUMS.
606.    */
607. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
608.                              BIGNUM **verifier, const BIGNUM *N,
609.                              const BIGNUM *g)

crypto/srp/srp_vfy.c:611:5: 
609.                              const BIGNUM *g)
610.   {
611. >     int result = 0;
612.       BIGNUM *x = NULL;
613.       BN_CTX *bn_ctx = BN_CTX_new();

crypto/srp/srp_vfy.c:612:5: 
610.   {
611.       int result = 0;
612. >     BIGNUM *x = NULL;
613.       BN_CTX *bn_ctx = BN_CTX_new();
614.       unsigned char tmp2[MAX_LEN];

crypto/srp/srp_vfy.c:613:5: Skipping BN_CTX_new(): empty list of specs
611.       int result = 0;
612.       BIGNUM *x = NULL;
613.       BN_CTX *bn_ctx = BN_CTX_new();
           ^
614.       unsigned char tmp2[MAX_LEN];
615.       BIGNUM *salttmp = NULL;

crypto/srp/srp_vfy.c:615:5: 
613.       BN_CTX *bn_ctx = BN_CTX_new();
614.       unsigned char tmp2[MAX_LEN];
615. >     BIGNUM *salttmp = NULL;
616.   
617.       if ((user == NULL) ||

crypto/srp/srp_vfy.c:617:10: Taking false branch
615.       BIGNUM *salttmp = NULL;
616.   
617.       if ((user == NULL) ||
                ^
618.           (pass == NULL) ||
619.           (salt == NULL) ||

crypto/srp/srp_vfy.c:618:10: Taking false branch
616.   
617.       if ((user == NULL) ||
618.           (pass == NULL) ||
                ^
619.           (salt == NULL) ||
620.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))

crypto/srp/srp_vfy.c:619:10: Taking false branch
617.       if ((user == NULL) ||
618.           (pass == NULL) ||
619.           (salt == NULL) ||
                ^
620.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
621.           goto err;

crypto/srp/srp_vfy.c:620:10: Taking false branch
618.           (pass == NULL) ||
619.           (salt == NULL) ||
620.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                ^
621.           goto err;
622.   

crypto/srp/srp_vfy.c:620:32: Taking false branch
618.           (pass == NULL) ||
619.           (salt == NULL) ||
620.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                                      ^
621.           goto err;
622.   

crypto/srp/srp_vfy.c:620:47: Taking false branch
618.           (pass == NULL) ||
619.           (salt == NULL) ||
620.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                                                     ^
621.           goto err;
622.   

crypto/srp/srp_vfy.c:620:62: Taking false branch
618.           (pass == NULL) ||
619.           (salt == NULL) ||
620.           (verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
                                                                    ^
621.           goto err;
622.   

crypto/srp/srp_vfy.c:623:9: Taking false branch
621.           goto err;
622.   
623.       if (*salt == NULL) {
               ^
624.           if (RAND_bytes(tmp2, SRP_RANDOM_SALT_LEN) <= 0)
625.               goto err;

crypto/srp/srp_vfy.c:629:9: 
627.           salttmp = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
628.       } else {
629. >         salttmp = *salt;
630.       }
631.   

crypto/srp/srp_vfy.c:632:5: 
630.       }
631.   
632. >     x = SRP_Calc_x(salttmp, user, pass);
633.   
634.       *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:896:1: start of procedure BN_is_zero()
      894.   }
      895.   
      896. > int BN_is_zero(const BIGNUM *a)
      897.   {
      898.       return a->top == 0;

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

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

crypto/bn/bn_lib.c:899:1: return from a call to BN_is_zero
      897.   {
      898.       return a->top == 0;
      899. > }
      900.   
      901.   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:279:1: start of procedure CRYPTO_malloc()
    277.   }
    278.   
    279. > void *CRYPTO_malloc(int num, const char *file, int line)
    280.   {
    281.       void *ret = NULL;

crypto/mem.c:281:5: 
    279.   void *CRYPTO_malloc(int num, const char *file, int line)
    280.   {
    281. >     void *ret = NULL;
    282.   
    283.       if (num <= 0)

crypto/mem.c:283:9: Taking true branch
    281.       void *ret = NULL;
    282.   
    283.       if (num <= 0)
                   ^
    284.           return NULL;
    285.   

crypto/mem.c:284:9: 
    282.   
    283.       if (num <= 0)
    284. >         return NULL;
    285.   
    286.       if (allow_customize)

crypto/mem.c:313:1: return from a call to CRYPTO_malloc
    311.   
    312.       return ret;
    313. > }
    314.   
    315.   void *CRYPTO_zalloc(int num, 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:634:5: Skipping BN_new(): empty list of specs
632.       x = SRP_Calc_x(salttmp, user, pass);
633.   
634.       *verifier = BN_new();
           ^
635.       if (*verifier == NULL)
636.           goto err;

crypto/srp/srp_vfy.c:635:9: Taking false branch
633.   
634.       *verifier = BN_new();
635.       if (*verifier == NULL)
               ^
636.           goto err;
637.   

crypto/srp/srp_vfy.c:638:10: 
636.           goto err;
637.   
638. >     if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
639.           BN_clear_free(*verifier);
640.           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:911:1: start of procedure BN_is_odd()
    909.   }
    910.   
    911. > int BN_is_odd(const BIGNUM *a)
    912.   {
    913.       return (a->top > 0) && (a->d[0] & 1);

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

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

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

crypto/bn/bn_lib.c:914:1: return from a call to BN_is_odd
    912.   {
    913.       return (a->top > 0) && (a->d[0] & 1);
    914. > }
    915.   
    916.   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:962:1: start of procedure BN_get_flags()
      960.   }
      961.   
      962. > int BN_get_flags(const BIGNUM *b, int n)
      963.   {
      964.       return b->flags & n;

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