On 07/12/2013 11:24 AM, Matt Turner wrote:
On Fri, Jul 12, 2013 at 11:10 AM, Matt Turner <matts...@gmail.com> wrote:
Previously, vec3 b = {{ 1.0, 2.0, 3.0 }} would cause a segfault because
the we dereferenced the constructor_type field which was NULL.

Arrays, structs, and matrices were unaffected.

This is a bad commit message. Use this instead:

_mesa_ast_set_aggregate_type walks through declarations initialized with
C-style aggregate initializers and stops when it runs out of LHS
declarations or RHS expressions.

In the example

    vec4 v = {{{1, 2, 3, 4}}};

_mesa_ast_set_aggregate_type would not recurse into the subexpressions
(since vec4s do not contain types that can be initialized with an
aggregate initializer) to set their <constructor_type>s. Later in ::hir
we would dereference the NULL pointer and segfault.

If <constructor_type> is NULL in ::hir we know that the LHS and RHS
were unbalanced and the code is illegal.

Arrays, structs, and matrices were unaffected.

Seems reasonable!

Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to