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


test/handshake_helper.c:85:1: start of procedure info_cb()
83.   static int ex_data_idx;
84.   
85. > static void info_cb(const SSL *s, int where, int ret)
86.   {
87.       if (where & SSL_CB_ALERT) {

test/handshake_helper.c:87:9: Taking true branch
85.   static void info_cb(const SSL *s, int where, int ret)
86.   {
87.       if (where & SSL_CB_ALERT) {
              ^
88.           HANDSHAKE_EX_DATA *ex_data =
89.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

test/handshake_helper.c:88:9: 
86.   {
87.       if (where & SSL_CB_ALERT) {
88. >         HANDSHAKE_EX_DATA *ex_data =
89.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
90.           if (where & SSL_CB_WRITE) {

ssl/ssl_lib.c:3745:1: start of procedure SSL_get_ex_data()
  3743.   }
  3744.   
  3745. > void *SSL_get_ex_data(const SSL *s, int idx)
  3746.   {
  3747.       return (CRYPTO_get_ex_data(&s->ex_data, idx));

ssl/ssl_lib.c:3747:5: 
  3745.   void *SSL_get_ex_data(const SSL *s, int idx)
  3746.   {
  3747. >     return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3748.   }
  3749.   

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

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

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

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

ssl/ssl_lib.c:3748:1: return from a call to SSL_get_ex_data
  3746.   {
  3747.       return (CRYPTO_get_ex_data(&s->ex_data, idx));
  3748. > }
  3749.   
  3750.   int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)

test/handshake_helper.c:90:13: Taking false branch
88.           HANDSHAKE_EX_DATA *ex_data =
89.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
90.           if (where & SSL_CB_WRITE) {
                  ^
91.               ex_data->alert_sent = ret;
92.               if (strcmp(SSL_alert_type_string(ret), "F") == 0

test/handshake_helper.c:96:13: 
94.                   ex_data->num_fatal_alerts_sent++;
95.           } else {
96. >             ex_data->alert_received = ret;
97.           }
98.       }

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}']