Commit 9e73f7a6 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winex11.drv: Limit formats to nMaxFormats in wglChoosePixelFormatARB.

parent b168da77
...@@ -2906,7 +2906,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt ...@@ -2906,7 +2906,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
* 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(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); gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id);
if (gl_test) { if (gl_test) {
ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n"); 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 ...@@ -2922,10 +2923,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
if( ((run == 0) && fmt->offscreenOnly) || ((run == 1) && !fmt->offscreenOnly) ) if( ((run == 0) && fmt->offscreenOnly) || ((run == 1) && !fmt->offscreenOnly) )
continue; continue;
if(pfmt_it < nMaxFormats) {
piFormats[pfmt_it] = fmt->iPixelFormat; piFormats[pfmt_it] = fmt->iPixelFormat;
TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]); TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]);
}
pfmt_it++; pfmt_it++;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment