test/handshake_helper.c:97: error: NULL_DEREFERENCE
  pointer `ex_data` last assigned on line 93 could be null and is dereferenced at line 97, column 9.
Showing all 19 steps of the trace


test/handshake_helper.c:90:1: start of procedure select_server_ctx()
88.    * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK.
89.    */
90. > static int select_server_ctx(SSL *s, void *arg, int ignore)
91.   {
92.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);

test/handshake_helper.c:92:5: 
90.   static int select_server_ctx(SSL *s, void *arg, int ignore)
91.   {
92. >     const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
93.       HANDSHAKE_EX_DATA *ex_data =
94.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

ssl/ssl_lib.c:2081:1: start of procedure SSL_get_servername()
  2079.    */
  2080.   
  2081. > const char *SSL_get_servername(const SSL *s, const int type)
  2082.   {
  2083.       if (type != TLSEXT_NAMETYPE_host_name)

ssl/ssl_lib.c:2083:9: Taking false branch
  2081.   const char *SSL_get_servername(const SSL *s, const int type)
  2082.   {
  2083.       if (type != TLSEXT_NAMETYPE_host_name)
                  ^
  2084.           return NULL;
  2085.   

ssl/ssl_lib.c:2086:12: Condition is true
  2084.           return NULL;
  2085.   
  2086.       return s->session && !s->tlsext_hostname ?
                     ^
  2087.           s->session->tlsext_hostname : s->tlsext_hostname;
  2088.   }

ssl/ssl_lib.c:2086:27: Condition is true
  2084.           return NULL;
  2085.   
  2086.       return s->session && !s->tlsext_hostname ?
                                    ^
  2087.           s->session->tlsext_hostname : s->tlsext_hostname;
  2088.   }

ssl/ssl_lib.c:2086:12: 
  2084.           return NULL;
  2085.   
  2086. >     return s->session && !s->tlsext_hostname ?
  2087.           s->session->tlsext_hostname : s->tlsext_hostname;
  2088.   }

ssl/ssl_lib.c:2086:5: 
  2084.           return NULL;
  2085.   
  2086. >     return s->session && !s->tlsext_hostname ?
  2087.           s->session->tlsext_hostname : s->tlsext_hostname;
  2088.   }

ssl/ssl_lib.c:2088:1: return from a call to SSL_get_servername
  2086.       return s->session && !s->tlsext_hostname ?
  2087.           s->session->tlsext_hostname : s->tlsext_hostname;
  2088. > }
  2089.   
  2090.   int SSL_get_servername_type(const SSL *s)

test/handshake_helper.c:93:5: 
91.   {
92.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
93. >     HANDSHAKE_EX_DATA *ex_data =
94.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
95.   

ssl/ssl_lib.c:3525:1: start of procedure SSL_get_ex_data()
  3523.   }
  3524.   
  3525. > void *SSL_get_ex_data(const SSL *s, int idx)
  3526.   {
  3527.       return (CRYPTO_get_ex_data(&s->ex_data, idx));

ssl/ssl_lib.c:3527:5: 
  3525.   void *SSL_get_ex_data(const SSL *s, int idx)
  3526.   {
  3527. >     return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3528.   }
  3529.   

crypto/ex_data.c:374:1: start of procedure CRYPTO_get_ex_data()
    372.    * particular index in the class used by this variable
    373.    */
    374. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    375.   {
    376.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:376:9: Taking true branch
    374.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    375.   {
    376.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    377.           return NULL;
    378.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:377:9: 
    375.   {
    376.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    377. >         return NULL;
    378.       return sk_void_value(ad->sk, idx);
    379.   }

crypto/ex_data.c:379:1: return from a call to CRYPTO_get_ex_data
    377.           return NULL;
    378.       return sk_void_value(ad->sk, idx);
    379. > }

ssl/ssl_lib.c:3528:1: return from a call to SSL_get_ex_data
  3526.   {
  3527.       return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3528. > }
  3529.   
  3530.   int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)

test/handshake_helper.c:96:9: Taking true branch
94.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
95.   
96.       if (servername == NULL) {
              ^
97.           ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
98.           return SSL_TLSEXT_ERR_NOACK;

test/handshake_helper.c:97:9: 
95.   
96.       if (servername == NULL) {
97. >         ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
98.           return SSL_TLSEXT_ERR_NOACK;
99.       }
