[Mesa-dev] [PATCH] glsl/ast: don't crash when func_name is NULL

Iago Toral itoral at igalia.com
Mon Jun 6 14:17:40 UTC 2016


I guess this makes sense:
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com

Out of curiosity, in which case do we get here and can't find a function
name?

On Mon, 2016-06-06 at 07:00 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This fixes a crash in
> GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types
> 
> If we can't find the func_name in one of these paths,
> we have emitted an earlier error so just return here.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/compiler/glsl/ast_function.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
> index a97e6c9..f74394f 100644
> --- a/src/compiler/glsl/ast_function.cpp
> +++ b/src/compiler/glsl/ast_function.cpp
> @@ -2078,6 +2078,10 @@ ast_function_expression::hir(exec_list *instructions,
>           func_name = id->primary_expression.identifier;
>        }
>  
> +      /* an error was emitted earlier */
> +      if (!func_name)
> +         return ir_rvalue::error_value(ctx);
> +
>        ir_function_signature *sig =
>  	 match_function_by_name(func_name, &actual_parameters, state);
>  




More information about the mesa-dev mailing list