diff options
author | Martin Storsjo <martin@martin.st> | 2013-08-11 21:40:28 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2013-08-11 21:58:40 +0300 |
commit | bf5add6bd5d87796621799d9da82db06b5d15f60 (patch) | |
tree | 7da9e7c1aaf81373cd36d3c4b9e0b7407741f1e1 /emulator/opengl/host | |
parent | 6da9a761cd06c67a9c30534b4da2b8447aced5d0 (diff) | |
download | sdk-bf5add6bd5d87796621799d9da82db06b5d15f60.zip sdk-bf5add6bd5d87796621799d9da82db06b5d15f60.tar.gz sdk-bf5add6bd5d87796621799d9da82db06b5d15f60.tar.bz2 |
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
Diffstat (limited to 'emulator/opengl/host')
-rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/FBConfig.cpp | 4 |
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 089f1da..ca7351e 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; |