Roderick Colenbrander : wgl: Fix piAttributes NULL crash.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 4 04:45:06 CST 2007


Module: wine
Branch: master
Commit: e4eac235f1a779bea629d409f54caecdf0696093
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e4eac235f1a779bea629d409f54caecdf0696093

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Thu Jan  4 00:15:54 2007 +0100

wgl: Fix piAttributes NULL crash.

---

 dlls/winex11.drv/opengl.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index e0ce8b0..ebc980e 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -605,6 +605,10 @@ static int ConvertAttribWGLtoGLX(const i
   int wantColorBits = 0;
   int sz_alpha = 0;
 
+  /* The list of WGL attributes is allowed to be NULL, so don't return -1 (error) but just 0 */
+  if(iWGLAttr == NULL)
+    return 0;
+
   while (0 != iWGLAttr[cur]) {
     TRACE("pAttr[%d] = %x\n", cur, iWGLAttr[cur]);
 
@@ -1963,7 +1967,7 @@ static HPBUFFERARB WINAPI X11DRV_wglCrea
     }
     PUSH2(attribs, GLX_PBUFFER_WIDTH,  iWidth);
     PUSH2(attribs, GLX_PBUFFER_HEIGHT, iHeight); 
-    while (0 != *piAttribList) {
+    while (piAttribList && 0 != *piAttribList) {
         int attr_v;
         switch (*piAttribList) {
             case WGL_TEXTURE_FORMAT_ARB: {




More information about the wine-cvs mailing list