diff options
author | Michael Chock <mchock@nvidia.com> | 2012-06-21 12:53:17 -0700 |
---|---|---|
committer | Michael Chock <mchock@nvidia.com> | 2012-09-12 15:13:16 -0700 |
commit | 0673e1e2d77c673c2e9bc57616a02c3188b55ad1 (patch) | |
tree | ac100a04f562c6b9863d8d7d33e97232087b1f33 /opengl/libs/EGL | |
parent | d7007cd4bb2016a09ae8e8f746118f81fdd27f02 (diff) | |
download | frameworks_native-0673e1e2d77c673c2e9bc57616a02c3188b55ad1.zip frameworks_native-0673e1e2d77c673c2e9bc57616a02c3188b55ad1.tar.gz frameworks_native-0673e1e2d77c673c2e9bc57616a02c3188b55ad1.tar.bz2 |
Additional parameter validation for EGL functions
Change-Id: I841d005647559799edbc2c4824c61ea5791cf893
Diffstat (limited to 'opengl/libs/EGL')
-rw-r--r-- | opengl/libs/EGL/eglApi.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 1bc4eb7..c943ec1 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -386,8 +386,11 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, egl_connection_t* cnx = NULL; const egl_display_ptr dp = validate_display_connection(dpy, cnx); - if (dpy) { + if (dp) { if (share_list != EGL_NO_CONTEXT) { + if (!ContextRef(dp.get(), share_list).get()) { + return setError(EGL_BAD_CONTEXT, EGL_NO_CONTEXT); + } egl_context_t* const c = get_context(share_list); share_list = c->context; } @@ -465,7 +468,7 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, // validate the context (if not EGL_NO_CONTEXT) if ((ctx != EGL_NO_CONTEXT) && !_c.get()) { // EGL_NO_CONTEXT is valid - return EGL_FALSE; + return setError(EGL_BAD_CONTEXT, EGL_FALSE); } // these are the underlying implementation's object @@ -486,12 +489,12 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, impl_ctx = c->context; } else { // no context given, use the implementation of the current context + if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) { + // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT); + return setError(EGL_BAD_MATCH, EGL_FALSE); + } if (cur_c == NULL) { // no current context - if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) { - // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT); - return setError(EGL_BAD_MATCH, EGL_FALSE); - } // not an error, there is just no current context. return EGL_TRUE; } @@ -499,12 +502,14 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, // retrieve the underlying implementation's draw EGLSurface if (draw != EGL_NO_SURFACE) { + if (!_d.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE); d = get_surface(draw); impl_draw = d->surface; } // retrieve the underlying implementation's read EGLSurface if (read != EGL_NO_SURFACE) { + if (!_r.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE); r = get_surface(read); impl_read = r->surface; } |