summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2013-06-25 17:02:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-25 17:02:09 -0700
commitda22e6bf36a2a83efef83bd723714ea6af30f540 (patch)
tree276f8afc230b5ae021641c9eeb266b66c68a073d /opengl
parentbfc41519ce0ee04c7ec2681054d4a0f809ad0893 (diff)
parentdb8c267ec26997771eb718c29d3dacd4e738051b (diff)
downloadframeworks_native-da22e6bf36a2a83efef83bd723714ea6af30f540.zip
frameworks_native-da22e6bf36a2a83efef83bd723714ea6af30f540.tar.gz
frameworks_native-da22e6bf36a2a83efef83bd723714ea6af30f540.tar.bz2
am db8c267e: am 3c0425cd: am 0ecf0b8d: Merge "Additional parameter validation for EGL functions"
* commit 'db8c267ec26997771eb718c29d3dacd4e738051b': Additional parameter validation for EGL functions
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/eglApi.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 334e164..2bc9851 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -516,8 +516,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;
}
@@ -601,7 +604,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
@@ -622,12 +625,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;
}
@@ -635,12 +638,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;
}