[Mesa-dev] [PATCH] st/wgl: check for NULL piAttribList in wglCreatePbufferARB()
Brian Paul
brian.e.paul at gmail.com
Sat Jul 7 20:09:17 UTC 2018
Thanks for investigating that one!
Reviewed-by: Brian Paul <brianp at vmware.com>
On Fri, Jul 6, 2018 at 5:09 PM, Charmaine Lee <charmainel at vmware.com> wrote:
> Java2d opengl pipeline passes NULL piAttribList to
> wglCreatePbufferARB(). So skip parsing the attribute list
> if it is NULL.
> ---
> src/gallium/state_trackers/wgl/stw_ext_pbuffer.c | 80
> ++++++++++++------------
> 1 file changed, 41 insertions(+), 39 deletions(-)
>
> diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
> b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
> index d709faa..02ccb76 100644
> --- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
> +++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
> @@ -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;
> + }
> }
> }
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180707/f208e60b/attachment-0001.html>
More information about the mesa-dev
mailing list