Mesa (master): egl: Display may be NULL in _eglLookup*.
Chia-I Wu
olv at kemper.freedesktop.org
Thu Sep 9 16:18:40 UTC 2010
Module: Mesa
Branch: master
Commit: 08a482e7a9d13db5d4e6fd974942f6699d7d49dc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08a482e7a9d13db5d4e6fd974942f6699d7d49dc
Author: Chia-I Wu <olv at lunarg.com>
Date: Fri Sep 10 00:02:47 2010 +0800
egl: Display may be NULL in _eglLookup*.
This fixes several NULL dereferences.
---
src/egl/main/eglconfig.h | 2 +-
src/egl/main/eglmode.c | 2 +-
src/egl/main/eglscreen.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index ca63c40..0ad58cf 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -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;
}
diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c
index 37594cd..ed107d5 100644
--- a/src/egl/main/eglmode.c
+++ b/src/egl/main/eglmode.c
@@ -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 */
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index 8b8966f..9e39335 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -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++) {
More information about the mesa-commit
mailing list