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


test/handshake_helper.c:32:1: start of procedure info_cb()
30.   static int ex_data_idx;
31.   
32. > static void info_cb(const SSL *s, int where, int ret)
33.   {
34.       if (where & SSL_CB_ALERT) {

test/handshake_helper.c:34:9: Taking true branch
32.   static void info_cb(const SSL *s, int where, int ret)
33.   {
34.       if (where & SSL_CB_ALERT) {
              ^
35.           HANDSHAKE_EX_DATA *ex_data =
36.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));

test/handshake_helper.c:35:9: 
33.   {
34.       if (where & SSL_CB_ALERT) {
35. >         HANDSHAKE_EX_DATA *ex_data =
36.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
37.           if (where & SSL_CB_WRITE) {

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:37:13: Taking true branch
35.           HANDSHAKE_EX_DATA *ex_data =
36.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
37.           if (where & SSL_CB_WRITE) {
                  ^
38.               ex_data->alert_sent = ret;
39.           } else {

test/handshake_helper.c:38:13: 
36.               (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
37.           if (where & SSL_CB_WRITE) {
38. >             ex_data->alert_sent = ret;
39.           } else {
40.               ex_data->alert_received = ret;

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