summaryrefslogtreecommitdiffstats
path: root/src/glu
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-03 16:20:05 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-03 16:22:14 -0600
commitc2e1ee08b083638a7306e15ca48e9ea516d42dc4 (patch)
tree62b3f6a8c6f685b778d7bc923cd3832dff9261a3 /src/glu
parent2f8ff58c0e8fbb60974be9c2412db8610b2152e2 (diff)
downloadexternal_mesa3d-c2e1ee08b083638a7306e15ca48e9ea516d42dc4.zip
external_mesa3d-c2e1ee08b083638a7306e15ca48e9ea516d42dc4.tar.gz
external_mesa3d-c2e1ee08b083638a7306e15ca48e9ea516d42dc4.tar.bz2
Use temporary matrix in __gluInvertMatrixd() to fix aliasing problem (see bugs 12269, 6748)
Diffstat (limited to 'src/glu')
-rw-r--r--src/glu/sgi/libutil/project.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/glu/sgi/libutil/project.c b/src/glu/sgi/libutil/project.c
index d22989c..356b46b 100644
--- a/src/glu/sgi/libutil/project.c
+++ b/src/glu/sgi/libutil/project.c
@@ -171,9 +171,9 @@ static void __gluMultMatrixVecd(const GLdouble matrix[16], const GLdouble in[4],
** Invert 4x4 matrix.
** Contributed by David Moore (See Mesa bug #6748)
*/
-static int __gluInvertMatrixd(const GLdouble m[16], GLdouble inv[16])
+static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16])
{
- double det;
+ double inv[16], det;
int i;
inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15]
@@ -216,7 +216,7 @@ static int __gluInvertMatrixd(const GLdouble m[16], GLdouble inv[16])
det = 1.0 / det;
for (i = 0; i < 16; i++)
- inv[i] *= det;
+ invOut[i] = inv[i] * det;
return GL_TRUE;
}