Ken Thomases : winemac: Fix off-by-one errors when indexing into pixel_formats array with 1-based pixel format number .

Alexandre Julliard julliard at winehq.org
Fri Jun 21 11:28:10 CDT 2013


Module: wine
Branch: master
Commit: a8efa5271b5c4db9e1dc280cf37d9d199cb276bd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a8efa5271b5c4db9e1dc280cf37d9d199cb276bd

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Jun 21 03:34:00 2013 -0500

winemac: Fix off-by-one errors when indexing into pixel_formats array with 1-based pixel format number.

---

 dlls/winemac.drv/opengl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index b1d2c1e..931b9ee 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1555,7 +1555,7 @@ static BOOL macdrv_wglBindTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffer)
     switch (iBuffer)
     {
         case WGL_FRONT_LEFT_ARB:
-            if (pixel_formats[pbuffer->format].stereo)
+            if (pixel_formats[pbuffer->format - 1].stereo)
                 source = GL_FRONT_LEFT;
             else
                 source = GL_FRONT;
@@ -1564,7 +1564,7 @@ static BOOL macdrv_wglBindTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffer)
             source = GL_FRONT_RIGHT;
             break;
         case WGL_BACK_LEFT_ARB:
-            if (pixel_formats[pbuffer->format].stereo)
+            if (pixel_formats[pbuffer->format - 1].stereo)
                 source = GL_BACK_LEFT;
             else
                 source = GL_BACK;
@@ -1943,7 +1943,7 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat,
     TRACE("hdc %p iPixelFormat %d iWidth %d iHeight %d piAttribList %p\n",
           hdc, iPixelFormat, iWidth, iHeight, piAttribList);
 
-    if (!is_valid_pixel_format(iPixelFormat) || !pixel_formats[iPixelFormat].pbuffer)
+    if (!is_valid_pixel_format(iPixelFormat) || !pixel_formats[iPixelFormat - 1].pbuffer)
     {
         WARN("invalid pixel format %d\n", iPixelFormat);
         SetLastError(ERROR_INVALID_PIXEL_FORMAT);




More information about the wine-cvs mailing list