[Mesa-dev] [PATCH] glsl: Check that layout is non-null before dereferencing.

Timothy Arceri timothy.arceri at collabora.com
Tue May 17 01:49:15 UTC 2016


On Mon, 2016-05-16 at 14:51 -0700, Matt Turner wrote:
> It's checked everywhere else. Maybe is_interface implies layout is
> non-null. Likely not worth it.

Yeah is should only be null for structs. If it shuts up Coverity:

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

> 
> Found by Coverity (CID 1358495).
> ---
>  src/compiler/glsl/ast_to_hir.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp
> b/src/compiler/glsl/ast_to_hir.cpp
> index 338edc8..b4c6de2 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -6818,7 +6818,7 @@
> ast_process_struct_or_iface_block_members(exec_list *instructions,
>            * the structure may contain a structure that contains ...
> a matrix
>            * that need the proper layout.
>            */
> -         if (is_interface &&
> +         if (is_interface && layout &&
>               (layout->flags.q.uniform || layout->flags.q.buffer) &&
>               (field_type->without_array()->is_matrix()
>                || field_type->without_array()->is_record())) {


More information about the mesa-dev mailing list