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


test/handshake_helper.c:84:1: start of procedure select_server_ctx()
82.    * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK.
83.    */
84. > static int select_server_ctx(SSL *s, void *arg, int ignore)
85.   {
86.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);

test/handshake_helper.c:86:5: 
84.   static int select_server_ctx(SSL *s, void *arg, int ignore)
85.   {
86. >     const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
87.       HANDSHAKE_EX_DATA *ex_data =
88.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

ssl/ssl_lib.c:2052:1: start of procedure SSL_get_servername()
  2050.    */
  2051.   
  2052. > const char *SSL_get_servername(const SSL *s, const int type)
  2053.   {
  2054.       if (type != TLSEXT_NAMETYPE_host_name)

ssl/ssl_lib.c:2054:9: Taking false branch
  2052.   const char *SSL_get_servername(const SSL *s, const int type)
  2053.   {
  2054.       if (type != TLSEXT_NAMETYPE_host_name)
                  ^
  2055.           return NULL;
  2056.   

ssl/ssl_lib.c:2057:12: Condition is true
  2055.           return NULL;
  2056.   
  2057.       return s->session && !s->tlsext_hostname ?
                     ^
  2058.           s->session->tlsext_hostname : s->tlsext_hostname;
  2059.   }

ssl/ssl_lib.c:2057:27: Condition is true
  2055.           return NULL;
  2056.   
  2057.       return s->session && !s->tlsext_hostname ?
                                    ^
  2058.           s->session->tlsext_hostname : s->tlsext_hostname;
  2059.   }

ssl/ssl_lib.c:2057:12: 
  2055.           return NULL;
  2056.   
  2057. >     return s->session && !s->tlsext_hostname ?
  2058.           s->session->tlsext_hostname : s->tlsext_hostname;
  2059.   }

ssl/ssl_lib.c:2057:5: 
  2055.           return NULL;
  2056.   
  2057. >     return s->session && !s->tlsext_hostname ?
  2058.           s->session->tlsext_hostname : s->tlsext_hostname;
  2059.   }

ssl/ssl_lib.c:2059:1: return from a call to SSL_get_servername
  2057.       return s->session && !s->tlsext_hostname ?
  2058.           s->session->tlsext_hostname : s->tlsext_hostname;
  2059. > }
  2060.   
  2061.   int SSL_get_servername_type(const SSL *s)

test/handshake_helper.c:87:5: 
85.   {
86.       const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
87. >     HANDSHAKE_EX_DATA *ex_data =
88.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89.   

ssl/ssl_lib.c:3496:1: start of procedure SSL_get_ex_data()
  3494.   }
  3495.   
  3496. > void *SSL_get_ex_data(const SSL *s, int idx)
  3497.   {
  3498.       return (CRYPTO_get_ex_data(&s->ex_data, idx));

ssl/ssl_lib.c:3498:5: 
  3496.   void *SSL_get_ex_data(const SSL *s, int idx)
  3497.   {
  3498. >     return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3499.   }
  3500.   

crypto/ex_data.c:369:1: start of procedure CRYPTO_get_ex_data()
    367.    * particular index in the class used by this variable
    368.    */
    369. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    370.   {
    371.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:371:9: Taking true branch
    369.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    370.   {
    371.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    372.           return NULL;
    373.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:372:9: 
    370.   {
    371.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    372. >         return NULL;
    373.       return sk_void_value(ad->sk, idx);
    374.   }

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

ssl/ssl_lib.c:3499:1: return from a call to SSL_get_ex_data
  3497.   {
  3498.       return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3499. > }
  3500.   
  3501.   int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)

test/handshake_helper.c:90:9: Taking true branch
88.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89.   
90.       if (servername == NULL) {
              ^
91.           ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
92.           return SSL_TLSEXT_ERR_NOACK;

test/handshake_helper.c:91:9: 
89.   
90.       if (servername == NULL) {
91. >         ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
92.           return SSL_TLSEXT_ERR_NOACK;
93.       }
