summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-05-17 14:59:13 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-05-17 14:59:13 -0700
commite9078011588823a7613e8fd3e9ff5edabf14c5a8 (patch)
treea1884eded9174445ef3e8a21202c351d1c2a701f /opengl
parent4c748c66492c7d06b51e9b06b2bab170e0486b19 (diff)
parentdf9556f318f54c7bc129c440949111ce1a197d6b (diff)
downloadframeworks_base-e9078011588823a7613e8fd3e9ff5edabf14c5a8.zip
frameworks_base-e9078011588823a7613e8fd3e9ff5edabf14c5a8.tar.gz
frameworks_base-e9078011588823a7613e8fd3e9ff5edabf14c5a8.tar.bz2
am df9556f3: am 23100fd1: Merge "fix a crasher in our EGL wrapper when attrib_list is NULL in eglChooseConfig" into kraken
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libagl/egl.cpp9
-rw-r--r--opengl/libs/EGL/egl.cpp10
2 files changed, 13 insertions, 6 deletions
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index b6e0aae..7cb01d0 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -1525,8 +1525,13 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
}
if (ggl_unlikely(attrib_list==0)) {
- *num_config = 0;
- return EGL_TRUE;
+ /*
+ * A NULL attrib_list should be treated as though it was an empty
+ * one (terminated with EGL_NONE) as defined in
+ * section 3.4.1 "Querying Configurations" in the EGL specification.
+ */
+ static const EGLint dummy = EGL_NONE;
+ attrib_list = &dummy;
}
int numAttributes = 0;
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index e6cf792..ba09d08 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -843,10 +843,12 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
EGLint patch_index = -1;
GLint attr;
size_t size = 0;
- while ((attr=attrib_list[size]) != EGL_NONE) {
- if (attr == EGL_CONFIG_ID)
- patch_index = size;
- size += 2;
+ if (attrib_list) {
+ while ((attr=attrib_list[size]) != EGL_NONE) {
+ if (attr == EGL_CONFIG_ID)
+ patch_index = size;
+ size += 2;
+ }
}
if (patch_index >= 0) {
size += 2; // we need copy the sentinel as well