Mesa (master): egl_dri2/x11: error check coordinates in eglPostSubBufferNV

Chia-I Wu olv at kemper.freedesktop.org
Tue Dec 20 09:27:12 UTC 2011


Module: Mesa
Branch: master
Commit: eb7d1b9474b021769e2d1f1b64901c64130e53d8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb7d1b9474b021769e2d1f1b64901c64130e53d8

Author: Chia-I Wu <olv at lunarg.com>
Date:   Tue Dec 20 17:25:22 2011 +0800

egl_dri2/x11: error check coordinates in eglPostSubBufferNV

EGL_BAD_PARAMETER should be returned when any of the coordinates is negative.

---

 src/egl/drivers/dri2/platform_x11.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 08a2c8d..d789ec6 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -248,11 +248,8 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
       free(reply);
    }
 
-   if (dri2_dpy->dri2 && type == EGL_WINDOW_BIT &&
-       dri2_surf->base.RenderBuffer == EGL_BACK_BUFFER)
-      dri2_surf->base.PostSubBufferSupportedNV = EGL_TRUE;
-   else
-      dri2_surf->base.PostSubBufferSupportedNV = EGL_FALSE;
+   /* we always copy the back buffer to front */
+   dri2_surf->base.PostSubBufferSupportedNV = EGL_TRUE;
 
    return &dri2_surf->base;
 
@@ -760,6 +757,9 @@ dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
 {
    const EGLint rect[4] = { x, draw->Height - y - height, width, height };
 
+   if (x < 0 || y < 0 || width < 0 || height < 0)
+      _eglError(EGL_BAD_PARAMETER, "eglPostSubBufferNV");
+
    return dri2_swap_buffers_region(drv, disp, draw, 1, rect);
 }
 




More information about the mesa-commit mailing list