Jan Zerebecki : x11drv: Prevent out of bound access in DescribePixelFormat.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 14 12:04:30 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 433196d21393449f9344e32ad2f4be9f598f2ea4
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=433196d21393449f9344e32ad2f4be9f598f2ea4

Author: Jan Zerebecki <jan.wine at zerebecki.de>
Date:   Mon Mar 13 14:06:14 2006 +0100

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-cvs mailing list