summaryrefslogtreecommitdiff
authorMichel Dänzer <michel@tungstengraphics.com>2007-08-24 11:04:48 (GMT)
committer Michel Dänzer <michel@tungstengraphics.com>2007-08-24 11:04:48 (GMT)
commit095850596114178119a8cc854716ce0cc6e05121 (patch) (side-by-side diff)
treece06e1d94775f8925057bbe626278b847b506064
parent3305d17195e3a0a5555300555bd7703312fa489f (diff)
downloadxserver-095850596114178119a8cc854716ce0cc6e05121.zip
xserver-095850596114178119a8cc854716ce0cc6e05121.tar.gz
__glXDRIbindTexImage: Fail if no texture bound to pixmap's texture target.
We would most likely crash somewhere in Mesa if we tried to continue in this case.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--GL/glx/glxdri.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 685683d..c1f3eb7 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -374,17 +374,25 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
{
RegionPtr pRegion = NULL;
PixmapPtr pixmap;
- int bpp, override = 0;
+ int bpp, override = 0, texname;
GLenum format, type;
ScreenPtr pScreen = glxPixmap->pScreen;
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
+ CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
+ GL_TEXTURE_BINDING_2D :
+ GL_TEXTURE_BINDING_RECTANGLE_NV,
+ &texname));
+
+ if (!texname)
+ return __glXError(GLXBadContextState);
+
pixmap = (PixmapPtr) glxPixmap->pDraw;
if (screen->texOffsetStart && screen->driScreen.setTexOffset) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
- int i, firstEmpty = 16, texname;
+ int i, firstEmpty = 16;
for (i = 0; i < 16; i++) {
if (texOffsetOverride[i] == glxPixmap)
@@ -409,11 +417,6 @@ alreadyin:
glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext;
- CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
- GL_TEXTURE_BINDING_2D :
- GL_TEXTURE_BINDING_RECTANGLE_NV,
- &texname));
-
if (texname == glxPixmap->texname)
return Success;