st/wgl: check for NULL piAttribList in wglCreatePbufferARB()
authorCharmaine Lee <charmainel@vmware.com>
Fri, 6 Jul 2018 22:52:37 +0000 (15:52 -0700)
committerCharmaine Lee <charmainel@vmware.com>
Sat, 7 Jul 2018 00:32:49 +0000 (17:32 -0700)
Java2d opengl pipeline passes NULL piAttribList to
wglCreatePbufferARB(). So skip parsing the attribute list
if it is NULL.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
src/gallium/state_trackers/wgl/stw_ext_pbuffer.c

index d709faa60f24e2a1b70f77ee56f0989df67e49cb..02ccb76e277a8e63a4b44952ccb823dd8f4a3101 100644 (file)
@@ -101,45 +101,47 @@ wglCreatePbufferARB(HDC hCurrentDC,
       return 0;
    }
 
-   for (piAttrib = piAttribList; *piAttrib; piAttrib++) {
-      switch (*piAttrib) {
-      case WGL_PBUFFER_LARGEST_ARB:
-         piAttrib++;
-         useLargest = *piAttrib;
-         break;
-       case WGL_TEXTURE_FORMAT_ARB:
-          /* WGL_ARB_render_texture */
-          piAttrib++;
-          textureFormat = *piAttrib;
-          if (textureFormat != WGL_TEXTURE_RGB_ARB &&
-             textureFormat != WGL_TEXTURE_RGBA_ARB &&
-             textureFormat != WGL_NO_TEXTURE_ARB) {
-             SetLastError(ERROR_INVALID_DATA);
-             return 0;
-          }
-          break;
-       case WGL_TEXTURE_TARGET_ARB:
-          /* WGL_ARB_render_texture */
-          piAttrib++;
-          textureTarget = *piAttrib;
-          if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB &&
-              textureTarget != WGL_TEXTURE_1D_ARB &&
-              textureTarget != WGL_TEXTURE_2D_ARB &&
-              textureTarget != WGL_NO_TEXTURE_ARB) {
-             SetLastError(ERROR_INVALID_DATA);
-             return 0;
-          }
-          break;
-      case WGL_MIPMAP_TEXTURE_ARB:
-         /* WGL_ARB_render_texture */
-         piAttrib++;
-         textureMipmap = !!*piAttrib;
-         break;
-      default:
-         SetLastError(ERROR_INVALID_DATA);
-         debug_printf("wgl: Unsupported attribute 0x%x in %s\n",
-                      *piAttrib, __func__);
-         return 0;
+   if (piAttribList) {
+      for (piAttrib = piAttribList; *piAttrib; piAttrib++) {
+         switch (*piAttrib) {
+         case WGL_PBUFFER_LARGEST_ARB:
+            piAttrib++;
+            useLargest = *piAttrib;
+            break;
+          case WGL_TEXTURE_FORMAT_ARB:
+             /* WGL_ARB_render_texture */
+             piAttrib++;
+             textureFormat = *piAttrib;
+             if (textureFormat != WGL_TEXTURE_RGB_ARB &&
+                textureFormat != WGL_TEXTURE_RGBA_ARB &&
+                textureFormat != WGL_NO_TEXTURE_ARB) {
+                SetLastError(ERROR_INVALID_DATA);
+                return 0;
+             }
+             break;
+          case WGL_TEXTURE_TARGET_ARB:
+             /* WGL_ARB_render_texture */
+             piAttrib++;
+             textureTarget = *piAttrib;
+             if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB &&
+                 textureTarget != WGL_TEXTURE_1D_ARB &&
+                 textureTarget != WGL_TEXTURE_2D_ARB &&
+                 textureTarget != WGL_NO_TEXTURE_ARB) {
+                SetLastError(ERROR_INVALID_DATA);
+                return 0;
+             }
+             break;
+         case WGL_MIPMAP_TEXTURE_ARB:
+            /* WGL_ARB_render_texture */
+            piAttrib++;
+            textureMipmap = !!*piAttrib;
+            break;
+         default:
+            SetLastError(ERROR_INVALID_DATA);
+            debug_printf("wgl: Unsupported attribute 0x%x in %s\n",
+                         *piAttrib, __func__);
+            return 0;
+         }
       }
    }