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


test/handshake_helper.c:105:1: start of procedure select_server_ctx()
103.    * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK.
104.    */
105. > static int select_server_ctx(SSL *s, void *arg, int ignore)
106.   {
107.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);

test/handshake_helper.c:107:5: 
105.   static int select_server_ctx(SSL *s, void *arg, int ignore)
106.   {
107. >     const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
108.       HANDSHAKE_EX_DATA *ex_data =
109.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

ssl/ssl_lib.c:2515:1: start of procedure SSL_get_servername()
  2513.    */
  2514.   
  2515. > const char *SSL_get_servername(const SSL *s, const int type)
  2516.   {
  2517.       if (type != TLSEXT_NAMETYPE_host_name)

ssl/ssl_lib.c:2517:9: Taking false branch
  2515.   const char *SSL_get_servername(const SSL *s, const int type)
  2516.   {
  2517.       if (type != TLSEXT_NAMETYPE_host_name)
                  ^
  2518.           return NULL;
  2519.   

ssl/ssl_lib.c:2520:12: Condition is true
  2518.           return NULL;
  2519.   
  2520.       return s->session && !s->ext.hostname ?
                     ^
  2521.           s->session->ext.hostname : s->ext.hostname;
  2522.   }

ssl/ssl_lib.c:2520:27: Condition is true
  2518.           return NULL;
  2519.   
  2520.       return s->session && !s->ext.hostname ?
                                    ^
  2521.           s->session->ext.hostname : s->ext.hostname;
  2522.   }

ssl/ssl_lib.c:2520:12: 
  2518.           return NULL;
  2519.   
  2520. >     return s->session && !s->ext.hostname ?
  2521.           s->session->ext.hostname : s->ext.hostname;
  2522.   }

ssl/ssl_lib.c:2520:5: 
  2518.           return NULL;
  2519.   
  2520. >     return s->session && !s->ext.hostname ?
  2521.           s->session->ext.hostname : s->ext.hostname;
  2522.   }

ssl/ssl_lib.c:2522:1: return from a call to SSL_get_servername
  2520.       return s->session && !s->ext.hostname ?
  2521.           s->session->ext.hostname : s->ext.hostname;
  2522. > }
  2523.   
  2524.   int SSL_get_servername_type(const SSL *s)

test/handshake_helper.c:108:5: 
106.   {
107.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
108. >     HANDSHAKE_EX_DATA *ex_data =
109.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
110.   

ssl/ssl_lib.c:3926:1: start of procedure SSL_get_ex_data()
  3924.   }
  3925.   
  3926. > void *SSL_get_ex_data(const SSL *s, int idx)
  3927.   {
  3928.       return CRYPTO_get_ex_data(&s->ex_data, idx);

ssl/ssl_lib.c:3928:5: 
  3926.   void *SSL_get_ex_data(const SSL *s, int idx)
  3927.   {
  3928. >     return CRYPTO_get_ex_data(&s->ex_data, idx);
  3929.   }
  3930.   

crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data()
    391.    * particular index in the class used by this variable
    392.    */
    393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    394.   {
    395.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:395:9: Taking true branch
    393.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    394.   {
    395.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    396.           return NULL;
    397.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:396:9: 
    394.   {
    395.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    396. >         return NULL;
    397.       return sk_void_value(ad->sk, idx);
    398.   }

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

ssl/ssl_lib.c:3929:1: return from a call to SSL_get_ex_data
  3927.   {
  3928.       return CRYPTO_get_ex_data(&s->ex_data, idx);
  3929. > }
  3930.   
  3931.   int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)

test/handshake_helper.c:111:9: Taking true branch
109.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
110.   
111.       if (servername == NULL) {
               ^
112.           ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
113.           return SSL_TLSEXT_ERR_NOACK;

test/handshake_helper.c:112:9: 
110.   
111.       if (servername == NULL) {
112. >         ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
113.           return SSL_TLSEXT_ERR_NOACK;
114.       }
