egl: Display may be NULL in _eglLookup*.
authorChia-I Wu <olv@lunarg.com>
Thu, 9 Sep 2010 16:02:47 +0000 (00:02 +0800)
committerChia-I Wu <olv@lunarg.com>
Thu, 9 Sep 2010 16:18:14 +0000 (00:18 +0800)
This fixes several NULL dereferences.

src/egl/main/eglconfig.h
src/egl/main/eglmode.c
src/egl/main/eglscreen.c

index ca63c40..0ad58cf 100644 (file)
@@ -117,7 +117,7 @@ static INLINE _EGLConfig *
 _eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
 {
    _EGLConfig *conf = (_EGLConfig *) config;
-   if (!_eglCheckConfigHandle(config, dpy))
+   if (!dpy || !_eglCheckConfigHandle(config, dpy))
       conf = NULL;
    return conf;
 }
index 37594cd..ed107d5 100644 (file)
@@ -25,7 +25,7 @@ _eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp)
 {
    EGLint scrnum;
 
-   if (!disp->Screens)
+   if (!disp || !disp->Screens)
       return NULL;
 
    /* loop over all screens on the display */
index 8b8966f..9e39335 100644 (file)
@@ -69,7 +69,7 @@ _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display)
 {
    EGLint i;
 
-   if (!display->Screens)
+   if (!display || !display->Screens)
       return NULL;
 
    for (i = 0; i < display->Screens->Size; i++) {