[Mesa-dev] [PATCH] st/glsl_to_tgsi: prevent infinite loop
Eric Engestrom
eric at engestrom.ch
Tue May 31 01:20:12 UTC 2016
`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
More information about the mesa-dev
mailing list