mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 16:20:03 +01:00
glx: Work around wrong request lengths sent by mesa
mesa used to send too long requests for GLXDestroyPixmap, GLXDestroyWindow, GLXChangeDrawableAttributes, GLXGetDrawableAttributes and GLXGetFBConfigsSGIX. Fixes a regression introduced inec9c97c6bfX.Org bug#33324 <https://bugs.freedesktop.org/show_bug.cgi?id=33324> Reported-by: xunx.fang@intel.com Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit402b329c3a)
This commit is contained in:
parent
d6831f5aa1
commit
99520ddbb1
2 changed files with 22 additions and 9 deletions
|
|
@ -1133,7 +1133,8 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||||
{
|
{
|
||||||
ClientPtr client = cl->client;
|
ClientPtr client = cl->client;
|
||||||
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
|
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
|
||||||
REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq);
|
/* work around mesa bug, don't use REQUEST_SIZE_MATCH */
|
||||||
|
REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
|
||||||
return DoGetFBConfigs(cl, req->screen);
|
return DoGetFBConfigs(cl, req->screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1357,7 +1358,9 @@ int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
|
||||||
ClientPtr client = cl->client;
|
ClientPtr client = cl->client;
|
||||||
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
|
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXDestroyPixmapReq);
|
/* should be REQUEST_SIZE_MATCH, but mesa's glXDestroyPixmap used to set
|
||||||
|
* length to 3 instead of 2 */
|
||||||
|
REQUEST_AT_LEAST_SIZE(xGLXDestroyPixmapReq);
|
||||||
|
|
||||||
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
|
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
|
||||||
}
|
}
|
||||||
|
|
@ -1499,7 +1502,13 @@ int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
||||||
client->errorValue = req->numAttribs;
|
client->errorValue = req->numAttribs;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
/* mesa sends an additional 8 bytes */
|
||||||
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
|
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
|
||||||
|
#else
|
||||||
|
if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
|
||||||
|
return BadLength;
|
||||||
|
#endif
|
||||||
|
|
||||||
return DoChangeDrawableAttributes(cl->client, req->drawable,
|
return DoChangeDrawableAttributes(cl->client, req->drawable,
|
||||||
req->numAttribs, (CARD32 *) (req + 1));
|
req->numAttribs, (CARD32 *) (req + 1));
|
||||||
|
|
@ -1564,7 +1573,8 @@ int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
|
||||||
ClientPtr client = cl->client;
|
ClientPtr client = cl->client;
|
||||||
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
|
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXDestroyWindowReq);
|
/* mesa's glXDestroyWindow used to set length to 3 instead of 2 */
|
||||||
|
REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
|
||||||
|
|
||||||
return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
|
return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
|
||||||
}
|
}
|
||||||
|
|
@ -1873,7 +1883,8 @@ int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
||||||
ClientPtr client = cl->client;
|
ClientPtr client = cl->client;
|
||||||
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
|
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq);
|
/* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */
|
||||||
|
REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
|
||||||
|
|
||||||
return DoGetDrawableAttributes(cl, req->drawable);
|
return DoGetDrawableAttributes(cl, req->drawable);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
|
||||||
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
|
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq);
|
REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
|
||||||
|
|
||||||
__GLX_SWAP_INT(&req->screen);
|
__GLX_SWAP_INT(&req->screen);
|
||||||
return __glXDisp_GetFBConfigsSGIX(cl, pc);
|
return __glXDisp_GetFBConfigsSGIX(cl, pc);
|
||||||
|
|
@ -369,7 +369,7 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
|
||||||
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
|
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
|
REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq);
|
||||||
|
|
||||||
__GLX_SWAP_SHORT(&req->length);
|
__GLX_SWAP_SHORT(&req->length);
|
||||||
__GLX_SWAP_INT(&req->glxpixmap);
|
__GLX_SWAP_INT(&req->glxpixmap);
|
||||||
|
|
@ -477,7 +477,9 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
||||||
client->errorValue = req->numAttribs;
|
client->errorValue = req->numAttribs;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
|
if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
|
||||||
|
return BadLength;
|
||||||
|
|
||||||
attribs = (CARD32*)(req + 1);
|
attribs = (CARD32*)(req + 1);
|
||||||
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
|
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
|
||||||
|
|
||||||
|
|
@ -543,7 +545,7 @@ int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
|
||||||
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
|
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXDestroyWindowReq);
|
REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
|
||||||
|
|
||||||
__GLX_SWAP_INT(&req->glxwindow);
|
__GLX_SWAP_INT(&req->glxwindow);
|
||||||
|
|
||||||
|
|
@ -743,7 +745,7 @@ int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
||||||
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
|
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq);
|
REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
|
||||||
|
|
||||||
__GLX_SWAP_SHORT(&req->length);
|
__GLX_SWAP_SHORT(&req->length);
|
||||||
__GLX_SWAP_INT(&req->drawable);
|
__GLX_SWAP_INT(&req->drawable);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue