From e4c1bcacef9380bbf72f616dc4e6f72ff5741678 Mon Sep 17 00:00:00 2001 From: Jian Zhao Date: Wed, 5 Jan 2011 10:41:20 +0800 Subject: [PATCH] mesa: fix an error in uniform arrays in row calculating. Fix the error in uniform row calculating, it may alloc one line more which may cause out of range on memory usage, sometimes program aborted when free the memory. NOTE: This is a candidate for 7.9 and 7.10 branches. Signed-off-by: Brian Paul (cherry picked from commit 2a7380e9c3a040356599a5b7740aa24e067fc1f5) --- src/mesa/main/uniforms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index a5d7da51f07..5224b039ab6 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -278,7 +278,7 @@ get_uniform_rows_cols(const struct gl_program_parameter *p, *cols = p->Size; } else { - *rows = p->Size / 4 + 1; + *rows = (p->Size + 3) / 4; if (p->Size % 4 == 0) *cols = 4; else