gallium/osmesa: add same checks to OSMesaMakeCurrent as the other osmesa
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>
Tue, 20 Aug 2013 10:35:28 +0000 (12:35 +0200)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Tue, 20 Aug 2013 10:36:17 +0000 (12:36 +0200)
Fixes a opengl crash in wine.

Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
src/gallium/state_trackers/osmesa/osmesa.c

index 9f9d2ad033c1d0edce10d55c33d972f25a9a7606..bb85e5c2f0c11135ca9da0fd1962a19a8cdc2c47 100644 (file)
@@ -616,10 +616,11 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
    struct osmesa_buffer *osbuffer;
    enum pipe_format color_format;
 
-   if (osmesa->format == OSMESA_RGB_565 && type != GL_UNSIGNED_SHORT_5_6_5) {
+   if (!osmesa || !buffer || width < 1 || height < 1) {
       return GL_FALSE;
    }
-   if (width < 1 || height < 1) {
+
+   if (osmesa->format == OSMESA_RGB_565 && type != GL_UNSIGNED_SHORT_5_6_5) {
       return GL_FALSE;
    }