[Mesa-dev] [PATCH] st/glsl_to_tgsi: prevent infinite loop

Marek Olšák maraeo at gmail.com
Tue May 31 10:12:32 UTC 2016


Thanks. I'm gonna push this shortly.

Marek

On Tue, May 31, 2016 at 3:20 AM, Eric Engestrom <eric at engestrom.ch> wrote:
> `unsigned j` would never fail `j >= 0`, leading to an infinite loop as
> `j--` wraps around.
>
> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 423704c..3440407 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -2447,7 +2447,8 @@ shrink_array_declarations(struct array_decl *arrays, unsigned count,
>                            GLbitfield64 double_usage_mask,
>                            GLbitfield patch_usage_mask)
>  {
> -   unsigned i, j;
> +   unsigned i;
> +   int j;
>
>     /* Fix array declarations by removing unused array elements at both ends
>      * of the arrays. For example, mat4[3] where only mat[1] is used.
> --
> 2.8.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list