summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVinson Lee <vlee@vmware.com>2010-02-27 15:07:30 -0800
committerVinson Lee <vlee@vmware.com>2010-02-27 15:07:30 -0800
commitb22437937fece754d9644a9d4ccb8db981d5e16c (patch)
tree9a32f82a43bf88af46e9b6e677731e7ea9db854a /src
parente31a37966154cc8171a8663cf5aa4ef1dd070f97 (diff)
tdfx: Add asserts to check for null pointer dereferences.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c2
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_texstate.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index d554bcdc92..26de09503a 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -295,6 +295,8 @@ tdfxSwapBuffers( __DRIdrawable *driDrawPriv )
}
#endif
+ assert(fxMesa);
+
if (fxMesa->scissoredClipRects) {
/* restore clip rects without scissor box */
fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
index 6658b4d0c3..b04f48c7a7 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
@@ -2142,11 +2142,13 @@ tdfxUpdateTextureBinding( GLcontext *ctx )
ctx->Texture.Unit[0]._ReallyEnabled == 0) {
/* Only unit 0 2D enabled */
if (shared->umaTexMemory) {
+ assert(ti0);
fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr;
fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[0].Info = &(ti0->info);
}
else {
+ assert(ti0);
if (ti0->LODblend && ti0->whichTMU == TDFX_TMU_SPLIT) {
fxMesa->TexSource[0].StartAddress = ti0->tm[TDFX_TMU0]->startAddr;
fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD;
@@ -2185,20 +2187,26 @@ tdfxUpdateTextureBinding( GLcontext *ctx )
/* Both 2D enabled */
if (shared->umaTexMemory) {
const FxU32 tmu0 = 0, tmu1 = 1;
+
+ assert(ti0);
fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr;
fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu0].Info = &(ti0->info);
+ assert(ti1);
fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr;
fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu1].Info = &(ti1->info);
}
else {
const FxU32 tmu0 = 0, tmu1 = 1;
+
+ assert(ti0);
fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr;
fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu0].Info = &(ti0->info);
+ assert(ti1);
fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr;
fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu1].Info = &(ti1->info);