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


test/handshake_helper.c:99:1: start of procedure select_server_ctx()
97.    * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK.
98.    */
99. > static int select_server_ctx(SSL *s, void *arg, int ignore)
100.   {
101.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);

test/handshake_helper.c:101:5: 
99.   static int select_server_ctx(SSL *s, void *arg, int ignore)
100.   {
101. >     const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
102.       HANDSHAKE_EX_DATA *ex_data =
103.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

ssl/ssl_lib.c:2411:1: start of procedure SSL_get_servername()
  2409.    */
  2410.   
  2411. > const char *SSL_get_servername(const SSL *s, const int type)
  2412.   {
  2413.       if (type != TLSEXT_NAMETYPE_host_name)

ssl/ssl_lib.c:2413:9: Taking false branch
  2411.   const char *SSL_get_servername(const SSL *s, const int type)
  2412.   {
  2413.       if (type != TLSEXT_NAMETYPE_host_name)
                  ^
  2414.           return NULL;
  2415.   

ssl/ssl_lib.c:2416:12: Condition is true
  2414.           return NULL;
  2415.   
  2416.       return s->session && !s->ext.hostname ?
                     ^
  2417.           s->session->ext.hostname : s->ext.hostname;
  2418.   }

ssl/ssl_lib.c:2416:27: Condition is true
  2414.           return NULL;
  2415.   
  2416.       return s->session && !s->ext.hostname ?
                                    ^
  2417.           s->session->ext.hostname : s->ext.hostname;
  2418.   }

ssl/ssl_lib.c:2416:12: 
  2414.           return NULL;
  2415.   
  2416. >     return s->session && !s->ext.hostname ?
  2417.           s->session->ext.hostname : s->ext.hostname;
  2418.   }

ssl/ssl_lib.c:2416:5: 
  2414.           return NULL;
  2415.   
  2416. >     return s->session && !s->ext.hostname ?
  2417.           s->session->ext.hostname : s->ext.hostname;
  2418.   }

ssl/ssl_lib.c:2418:1: return from a call to SSL_get_servername
  2416.       return s->session && !s->ext.hostname ?
  2417.           s->session->ext.hostname : s->ext.hostname;
  2418. > }
  2419.   
  2420.   int SSL_get_servername_type(const SSL *s)

test/handshake_helper.c:102:5: 
100.   {
101.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
102. >     HANDSHAKE_EX_DATA *ex_data =
103.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
104.   

ssl/ssl_lib.c:3784:1: start of procedure SSL_get_ex_data()
  3782.   }
  3783.   
  3784. > void *SSL_get_ex_data(const SSL *s, int idx)
  3785.   {
  3786.       return (CRYPTO_get_ex_data(&s->ex_data, idx));

ssl/ssl_lib.c:3786:5: 
  3784.   void *SSL_get_ex_data(const SSL *s, int idx)
  3785.   {
  3786. >     return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3787.   }
  3788.   

crypto/ex_data.c:379:1: start of procedure CRYPTO_get_ex_data()
    377.    * particular index in the class used by this variable
    378.    */
    379. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    380.   {
    381.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:381:9: Taking true branch
    379.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    380.   {
    381.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    382.           return NULL;
    383.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:382:9: 
    380.   {
    381.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    382. >         return NULL;
    383.       return sk_void_value(ad->sk, idx);
    384.   }

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

ssl/ssl_lib.c:3787:1: return from a call to SSL_get_ex_data
  3785.   {
  3786.       return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3787. > }
  3788.   
  3789.   int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)

test/handshake_helper.c:105:9: Taking true branch
103.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
104.   
105.       if (servername == NULL) {
               ^
106.           ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
107.           return SSL_TLSEXT_ERR_NOACK;

test/handshake_helper.c:106:9: 
104.   
105.       if (servername == NULL) {
106. >         ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
107.           return SSL_TLSEXT_ERR_NOACK;
108.       }
