x11drv: prevent out of bound access in DescribePixelFormat
Jan Zerebecki
jan.wine at zerebecki.de
Mon Mar 13 07:06:14 CST 2006
I came accross this one when trying to run Starscape in OpenGL
mode.
If this patch is rejected from inclusion, please tell me why, as i would have to
ask anyway.
From: Jan Zerebecki <jan.wine at zerebecki.de>
Changelog:
x11drv: prevent out of bound access in DescribePixelFormat
---
dlls/x11drv/opengl.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/x11drv/opengl.c b/dlls/x11drv/opengl.c
index a2a591e..eb58da9 100644
--- a/dlls/x11drv/opengl.c
+++ b/dlls/x11drv/opengl.c
@@ -369,9 +369,9 @@ int X11DRV_DescribePixelFormat(X11DRV_PD
return 0;
}
- if (nCfgs < iPixelFormat) {
- ERR("unexpected iPixelFormat(%d) > nFormats(%d), returns NULL\n", iPixelFormat, nCfgs);
- return 0; /* unespected error */
+ if (nCfgs < iPixelFormat || 1 > iPixelFormat) {
+ WARN("unexpected iPixelFormat(%d): not >=1 and <=nFormats(%d), returning NULL\n", iPixelFormat, nCfgs);
+ return 0;
}
ret = nCfgs;
More information about the wine-patches
mailing list