From 9e73f7a6df5cdfe4cbe714224ad36df776c02af5 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Wed, 6 Jun 2012 21:55:34 -0700 Subject: [PATCH] winex11.drv: Limit formats to nMaxFormats in wglChoosePixelFormatARB. --- dlls/winex11.drv/opengl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index c84226bfa54..3bdf7718d97 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2903,10 +2903,11 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt } /* Loop through all matching formats and check if they are suitable. - * Note that this function should at max return nMaxFormats different formats */ + * Note that this function should at max return nMaxFormats different formats */ for(run=0; run < 2; run++) { - for (it = 0; it < nCfgs; ++it) { + for (it = 0; it < nCfgs && pfmt_it < nMaxFormats; ++it) + { gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id); if (gl_test) { ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n"); @@ -2922,10 +2923,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt if( ((run == 0) && fmt->offscreenOnly) || ((run == 1) && !fmt->offscreenOnly) ) continue; - if(pfmt_it < nMaxFormats) { - piFormats[pfmt_it] = fmt->iPixelFormat; - TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]); - } + piFormats[pfmt_it] = fmt->iPixelFormat; + TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]); pfmt_it++; } } -- 2.11.4.GIT