Mesa (7.10): mesa: fix an error in uniform arrays in row calculating.

Ian Romanick idr at kemper.freedesktop.org
Wed Jan 26 00:19:08 UTC 2011


Module: Mesa
Branch: 7.10
Commit: acc73692851b2b222833482851ce856ff267bff2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=acc73692851b2b222833482851ce856ff267bff2

Author: Jian Zhao <jian.j.zhao at intel.com>
Date:   Wed Jan  5 10:41:20 2011 +0800

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 at vmware.com>
(cherry picked from commit 2a7380e9c3a040356599a5b7740aa24e067fc1f5)

---

 src/mesa/main/uniforms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index d61856d..ea63dd0 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -511,7 +511,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




More information about the mesa-commit mailing list