[Mesa-dev] [Bug 48057] New: use of uninitialized variables by read_builtins()

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Mar 29 11:18:51 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=48057

             Bug #: 48057
           Summary: use of uninitialized variables by read_builtins()
    Classification: Unclassified
           Product: Mesa
           Version: 8.0
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
        AssignedTo: mesa-dev at lists.freedesktop.org
        ReportedBy: jstrother9109 at gmail.com


With 8.0.2 I receive the following using valgrind:


==15511== Conditional jump or move depends on uninitialised value(s)
==15511==    at 0x52AC1CA:
_mesa_glsl_parse_state::_mesa_glsl_parse_state(gl_context*, unsigned int,
void*) (glsl_parser_extras.cpp:118)
==15511==    by 0x52DC68F: read_builtins(unsigned int, char const*, char
const**, unsigned int) (builtin_function.cpp:44)
==15511==    by 0x52DC90F: _mesa_read_profile(_mesa_glsl_parse_state*, int,
char const*, char const**, int) (builtin_function.cpp:16205)
==15511==    by 0x52DCABE:
_mesa_glsl_initialize_functions(_mesa_glsl_parse_state*)
(builtin_function.cpp:16251)
==15511==    by 0x529C2C3: match_function_by_name(exec_list*, char const*,
YYLTYPE*, exec_list*, ir_call**, _mesa_glsl_parse_state*)
(ast_function.cpp:314)
==15511==    by 0x529F9FC: ast_function_expression::hir(exec_list*,
_mesa_glsl_parse_state*) (ast_function.cpp:1460)
==15511==    by 0x52A1CAC: ast_expression::hir(exec_list*,
_mesa_glsl_parse_state*) (ast_to_hir.cpp:1033)
==15511==    by 0x52A4C8D: ast_expression_statement::hir(exec_list*,
_mesa_glsl_parse_state*) (ast_to_hir.cpp:1813)
==15511==    by 0x52A4CFD: ast_compound_statement::hir(exec_list*,
_mesa_glsl_parse_state*) (ast_to_hir.cpp:1829)
==15511==    by 0x52A7F00: ast_function_definition::hir(exec_list*,
_mesa_glsl_parse_state*) (ast_to_hir.cpp:3312)
==15511==    by 0x529FF9E: _mesa_ast_to_hir(exec_list*,
_mesa_glsl_parse_state*) (ast_to_hir.cpp:87)
==15511==    by 0x527CF58: _mesa_glsl_compile_shader (ir_to_mesa.cpp:3342)
==15511==  Uninitialised value was created by a stack allocation
==15511==    at 0x52DC5F1: read_builtins(unsigned int, char const*, char
const**, unsigned int) (builtin_function.cpp:37)


The problem is fairly clear.  When fakeCtx is instantiated in read_builtins()
it is left uninitialized except for a few select members. The constructor for
_mesa_glsl_parse_state does not seem to have anticipated "fake contexts" and
uses a number of other members.

I would suggest a patch, but it looks like a non-trivial fix. Seems like
glsl_compiler wants to be standalone, even though all of the structures it uses
have dependencies in mesa/main.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the mesa-dev mailing list