sagarpant1 / mame

Other
0 stars 1 forks source link

Potential issue in 3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp: Unchecked return from initialization function #2

Open monocle-ai opened 4 years ago

monocle-ai commented 4 years ago

What is a Conditionally Uninitialized Variable? The return value of a function that is potentially used to initialize a local variable is not checked. Therefore, reading the local variable may result in undefined behavior.

1 instance of this defect were found in the following locations:


Instance 1 File : 3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp Enclosing Function : process_initializer Function : check_version@_mesa_glsl_parse_state https://github.com/sagarpant1/mame/blob/fe529afa8e0669d323dec9e3a575efc399009e5c/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp#L3012 Issue in: _initializerloc

Code extract:

    *    OpenGL."
    */
   if (var->data.mode == ir_var_uniform) {
      state->check_version(120, 0, &initializer_loc, <------ HERE
                           "cannot initialize uniforms");
   }

How can I fix it? Correct reference usage found in 3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp at line 4052. https://github.com/sagarpant1/mame/blob/fe529afa8e0669d323dec9e3a575efc399009e5c/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp#L4052 Code extract:

    */
   if ((var->data.mode == ir_var_function_inout || var->data.mode == ir_var_function_out)
       && type->is_array()
       && !state->check_version(120, 100, &loc, <------ HERE
                                "arrays cannot be out or inout parameters")) {
      type = glsl_type::error_type;
siva-msft commented 4 years ago

clearly initialized in l3003 - fp