diff options
author | Lingfeng Yang <lfy@google.com> | 2016-09-23 09:42:32 -0700 |
---|---|---|
committer | Lingfeng Yang <lfy@google.com> | 2016-09-23 09:44:00 -0700 |
commit | 30e1c241dba43b558333968e5c9415fdaae6d935 (patch) | |
tree | 7e4b8821f651ad203c0d9265d4403cff0a1088b5 | |
parent | e00ec9ddda30f6be5c027ccffd39e98a84e9acc9 (diff) | |
download | goldfish-opengl-30e1c241dba43b558333968e5c9415fdaae6d935.tar.gz |
Fix dEQP-EGL.functional.negative_api.choose_config
bug: 31703518
This CL fixes the above test and:
- Raises EGL_BAD_PARAMETER if the |num_config| pointer is null.
- Receives EGL errors from host-side config choosing.
Change-Id: I34599ab4a8648a442aafc0e8e97b45932a4bbf32
-rw-r--r-- | system/egl/egl.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp index 39ed259b..5cc8d174 100644 --- a/system/egl/egl.cpp +++ b/system/egl/egl.cpp @@ -723,6 +723,10 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig { VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); + if (!num_config) { + setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); + } + int attribs_size = 0; if (attrib_list) { const EGLint * attrib_p = attrib_list; @@ -736,6 +740,18 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig uint32_t* tempConfigs[config_size]; DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); *num_config = rcEnc->rcChooseConfig(rcEnc, (EGLint*)attrib_list, attribs_size * sizeof(EGLint), (uint32_t*)tempConfigs, config_size); + + if (*num_config <= 0) { + EGLint err = -(*num_config); + *num_config = 0; + switch (err) { + case EGL_BAD_ATTRIBUTE: + setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE); + default: + return EGL_FALSE; + } + } + if (configs!=NULL) { EGLint i=0; for (i=0;i<(*num_config);i++) { @@ -743,8 +759,6 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig } } - if (*num_config <= 0) - return EGL_FALSE; return EGL_TRUE; } |