aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2013-08-11 21:40:28 +0300
committerMartin Storsjo <martin@martin.st>2013-08-11 21:58:40 +0300
commitbf5add6bd5d87796621799d9da82db06b5d15f60 (patch)
tree7da9e7c1aaf81373cd36d3c4b9e0b7407741f1e1
parent6da9a761cd06c67a9c30534b4da2b8447aced5d0 (diff)
downloadsdk-bf5add6bd5d87796621799d9da82db06b5d15f60.tar.gz
sdk-bf5add6bd5d87796621799d9da82db06b5d15f60.tar.bz2
sdk-bf5add6bd5d87796621799d9da82db06b5d15f60.zip
Check the return value of eglChooseConfig
The EGL specs say that eglChooseConfig doesn't update num_config if it returns a failure (which is exactly what Translator/EGL/EglImp.cpp does). Therefore, if this function returned a failure (e.g. due to an unsupported egl attribute), nConfigs was left untouched, meaning that the configs array was left uninitialized but treated as if it was full of valid configs. Change-Id: I3809272298ea10d65dc939849d2e3c17d1158da6
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp b/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp
index 089f1dae0..ca7351e8a 100644
--- a/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp
@@ -203,7 +203,9 @@ int FBConfig::chooseConfig(FrameBuffer *fb, EGLint * attribs, uint32_t * configs
}
#endif
- s_egl.eglChooseConfig(dpy, newAttribs, matchedConfigs, nConfigs, &nConfigs);
+ if (!s_egl.eglChooseConfig(dpy, newAttribs, matchedConfigs, nConfigs, &nConfigs)) {
+ nConfigs = 0;
+ }
delete[] newAttribs;