crypto/ui/ui_util.c:111: error: NULL_DEREFERENCE
  pointer `data` last assigned on line 108 could be null and is dereferenced at line 111, column 23.
Showing all 25 steps of the trace


crypto/ui/ui_util.c:102:1: start of procedure ui_read()
100.       return 1;
101.   }
102. > static int ui_read(UI *ui, UI_STRING *uis)
103.   {
104.       switch (UI_get_string_type(uis)) {

crypto/ui/ui_util.c:104:5: 
102.   static int ui_read(UI *ui, UI_STRING *uis)
103.   {
104. >     switch (UI_get_string_type(uis)) {
105.       case UIT_PROMPT:
106.           {

crypto/ui/ui_lib.c:709:1: start of procedure UI_get_string_type()
  707.   }
  708.   
  709. > enum UI_string_types UI_get_string_type(UI_STRING *uis)
  710.   {
  711.       return uis->type;

crypto/ui/ui_lib.c:711:5: 
  709.   enum UI_string_types UI_get_string_type(UI_STRING *uis)
  710.   {
  711. >     return uis->type;
  712.   }
  713.   

crypto/ui/ui_lib.c:712:1: return from a call to UI_get_string_type
  710.   {
  711.       return uis->type;
  712. > }
  713.   
  714.   int UI_get_input_flags(UI_STRING *uis)

crypto/ui/ui_util.c:105:5: Switch condition is true. Entering switch case
103.   {
104.       switch (UI_get_string_type(uis)) {
105.       case UIT_PROMPT:
           ^
106.           {
107.               char result[PEM_BUFSIZE];

crypto/ui/ui_util.c:108:13: 
106.           {
107.               char result[PEM_BUFSIZE];
108. >             const struct pem_password_cb_data *data =
109.                   UI_method_get_ex_data(UI_get_method(ui), ui_method_data_index);
110.               int maxsize = UI_get_result_maxsize(uis);

crypto/ui/ui_lib.c:551:1: start of procedure UI_get_method()
  549.   }
  550.   
  551. > const UI_METHOD *UI_get_method(UI *ui)
  552.   {
  553.       return ui->meth;

crypto/ui/ui_lib.c:553:5: 
  551.   const UI_METHOD *UI_get_method(UI *ui)
  552.   {
  553. >     return ui->meth;
  554.   }
  555.   

crypto/ui/ui_lib.c:554:1: return from a call to UI_get_method
  552.   {
  553.       return ui->meth;
  554. > }
  555.   
  556.   const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth)

crypto/ui/ui_lib.c:704:1: start of procedure UI_method_get_ex_data()
  702.   }
  703.   
  704. > const void *UI_method_get_ex_data(const UI_METHOD *method, int idx)
  705.   {
  706.       return CRYPTO_get_ex_data(&method->ex_data, idx);

crypto/ui/ui_lib.c:706:5: 
  704.   const void *UI_method_get_ex_data(const UI_METHOD *method, int idx)
  705.   {
  706. >     return CRYPTO_get_ex_data(&method->ex_data, idx);
  707.   }
  708.   

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

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

crypto/ex_data.c:378:9: 
    376.   {
    377.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    378. >         return NULL;
    379.       return sk_void_value(ad->sk, idx);
    380.   }

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

crypto/ui/ui_lib.c:707:1: return from a call to UI_method_get_ex_data
  705.   {
  706.       return CRYPTO_get_ex_data(&method->ex_data, idx);
  707. > }
  708.   
  709.   enum UI_string_types UI_get_string_type(UI_STRING *uis)

crypto/ui/ui_util.c:110:13: 
108.               const struct pem_password_cb_data *data =
109.                   UI_method_get_ex_data(UI_get_method(ui), ui_method_data_index);
110. >             int maxsize = UI_get_result_maxsize(uis);
111.               int len = data->cb(result,
112.                                  maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,

crypto/ui/ui_lib.c:784:1: start of procedure UI_get_result_maxsize()
  782.   }
  783.   
  784. > int UI_get_result_maxsize(UI_STRING *uis)
  785.   {
  786.       switch (uis->type) {

crypto/ui/ui_lib.c:786:5: 
  784.   int UI_get_result_maxsize(UI_STRING *uis)
  785.   {
  786. >     switch (uis->type) {
  787.       case UIT_PROMPT:
  788.       case UIT_VERIFY:

crypto/ui/ui_lib.c:787:5: Switch condition is true. Entering switch case
  785.   {
  786.       switch (uis->type) {
  787.       case UIT_PROMPT:
             ^
  788.       case UIT_VERIFY:
  789.           return uis->_.string_data.result_maxsize;

crypto/ui/ui_lib.c:789:9: 
  787.       case UIT_PROMPT:
  788.       case UIT_VERIFY:
  789. >         return uis->_.string_data.result_maxsize;
  790.       case UIT_NONE:
  791.       case UIT_INFO:

crypto/ui/ui_lib.c:797:1: return from a call to UI_get_result_maxsize
  795.       }
  796.       return -1;
  797. > }
  798.   
  799.   int UI_set_result(UI *ui, UI_STRING *uis, const char *result)

crypto/ui/ui_util.c:112:32: Condition is false
110.               int maxsize = UI_get_result_maxsize(uis);
111.               int len = data->cb(result,
112.                                  maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,
                                      ^
113.                                  data->rwflag, UI_get0_user_data(ui));
114.   

crypto/ui/ui_util.c:111:13: 
109.                   UI_method_get_ex_data(UI_get_method(ui), ui_method_data_index);
110.               int maxsize = UI_get_result_maxsize(uis);
111. >             int len = data->cb(result,
112.                                  maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,
113.                                  data->rwflag, UI_get0_user_data(ui));

static int ui_read(UI *ui, UI_STRING *uis)
{
    switch (UI_get_string_type(uis)) {
    case UIT_PROMPT:
        {
            char result[PEM_BUFSIZE];
            const struct pem_password_cb_data *data =
                UI_method_get_ex_data(UI_get_method(ui), ui_method_data_index);
            int maxsize = UI_get_result_maxsize(uis);
            int len = data->cb(result,
                               maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,
                               data->rwflag, UI_get0_user_data(ui));
            if (len <= 0)
                return len;
            if (UI_set_result(ui, uis, result) >= 0)
                return 1;
            return 0;
        }
    case UIT_VERIFY:
    case UIT_NONE:
    case UIT_BOOLEAN:
    case UIT_INFO:
    case UIT_ERROR:
        break;
    }
    return 1;
}
['static int ui_read(UI *ui, UI_STRING *uis)\n{\n    switch (UI_get_string_type(uis)) {\n    case UIT_PROMPT:\n        {\n            char result[PEM_BUFSIZE];\n            const struct pem_password_cb_data *data =\n                UI_method_get_ex_data(UI_get_method(ui), ui_method_data_index);\n            int maxsize = UI_get_result_maxsize(uis);\n            int len = data->cb(result,\n                               maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,\n                               data->rwflag, UI_get0_user_data(ui));\n            if (len <= 0)\n                return len;\n            if (UI_set_result(ui, uis, result) >= 0)\n                return 1;\n            return 0;\n        }\n    case UIT_VERIFY:\n    case UIT_NONE:\n    case UIT_BOOLEAN:\n    case UIT_INFO:\n    case UIT_ERROR:\n        break;\n    }\n    return 1;\n}', 'enum UI_string_types UI_get_string_type(UI_STRING *uis)\n{\n    return uis->type;\n}', 'const UI_METHOD *UI_get_method(UI *ui)\n{\n    return ui->meth;\n}', 'const void *UI_method_get_ex_data(const UI_METHOD *method, int idx)\n{\n    return CRYPTO_get_ex_data(&method->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}', 'int UI_get_result_maxsize(UI_STRING *uis)\n{\n    switch (uis->type) {\n    case UIT_PROMPT:\n    case UIT_VERIFY:\n        return uis->_.string_data.result_maxsize;\n    case UIT_NONE:\n    case UIT_INFO:\n    case UIT_ERROR:\n    case UIT_BOOLEAN:\n        break;\n    }\n    return -1;\n}']