summaryrefslogtreecommitdiff
path: root/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
authorJian Zhao <jian.j.zhao@intel.com>2011-01-05 10:41:20 +0800
committerBrian Paul <brianp@vmware.com>2011-01-07 07:22:18 -0700
commit2a7380e9c3a040356599a5b7740aa24e067fc1f5 (patch)
tree7d227beaf273d83e3e7272a675ae64a14a96e355 /src/mesa/main/uniforms.c
parentdb61b9ce39bccc43140357652ceb78baaf2aea44 (diff)
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 <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/uniforms.c')
-rw-r--r--src/mesa/main/uniforms.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 58e6bafc91..aee2e6b4e9 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -513,7 +513,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