test/handshake_helper.c:74: error: NULL_DEREFERENCE
  pointer `ex_data` last assigned on line 71 could be null and is dereferenced at line 74, column 13.
Showing all 12 steps of the trace


test/handshake_helper.c:68:1: start of procedure info_cb()
66.   static int ex_data_idx;
67.   
68. > static void info_cb(const SSL *s, int where, int ret)
69.   {
70.       if (where & SSL_CB_ALERT) {

test/handshake_helper.c:70:9: Taking true branch
68.   static void info_cb(const SSL *s, int where, int ret)
69.   {
70.       if (where & SSL_CB_ALERT) {
              ^
71.           HANDSHAKE_EX_DATA *ex_data =
72.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

test/handshake_helper.c:71:9: 
69.   {
70.       if (where & SSL_CB_ALERT) {
71. >         HANDSHAKE_EX_DATA *ex_data =
72.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
73.           if (where & SSL_CB_WRITE) {

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:73:13: Taking true branch
71.           HANDSHAKE_EX_DATA *ex_data =
72.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
73.           if (where & SSL_CB_WRITE) {
                  ^
74.               ex_data->alert_sent = ret;
75.               if (strcmp(SSL_alert_type_string(ret), "F") == 0

test/handshake_helper.c:74:13: 
72.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
73.           if (where & SSL_CB_WRITE) {
74. >             ex_data->alert_sent = ret;
75.               if (strcmp(SSL_alert_type_string(ret), "F") == 0
76.                   || strcmp(SSL_alert_desc_string(ret), "CN") == 0)

static void info_cb(const SSL *s, int where, int ret)
{
    if (where & SSL_CB_ALERT) {
        HANDSHAKE_EX_DATA *ex_data =
            (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
        if (where & SSL_CB_WRITE) {
            ex_data->alert_sent = ret;
            if (strcmp(SSL_alert_type_string(ret), "F") == 0
                || strcmp(SSL_alert_desc_string(ret), "CN") == 0)
                ex_data->num_fatal_alerts_sent++;
        } else {
            ex_data->alert_received = ret;
        }
    }
}
['static void info_cb(const SSL *s, int where, int ret)\n{\n    if (where & SSL_CB_ALERT) {\n        HANDSHAKE_EX_DATA *ex_data =\n            (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));\n        if (where & SSL_CB_WRITE) {\n            ex_data->alert_sent = ret;\n            if (strcmp(SSL_alert_type_string(ret), "F") == 0\n                || strcmp(SSL_alert_desc_string(ret), "CN") == 0)\n                ex_data->num_fatal_alerts_sent++;\n        } else {\n            ex_data->alert_received = ret;\n        }\n    }\n}', 'void *SSL_get_ex_data(const SSL *s, int idx)\n{\n    return (CRYPTO_get_ex_data(&s->ex_data, idx));\n}', 'void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)\n{\n    if (ad->sk == NULL || idx >= sk_void_num(ad->sk))\n        return NULL;\n    return sk_void_value(ad->sk, idx);\n}']