From d8cf2ce6b8b2f29e24d8185a36618dd33a17cf8e Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Wed, 4 Jan 2012 16:25:10 +0200 Subject: egl: Add NULL check for num_config parameter EGL 1.5 specification says in 3.4.1: "An EGL_BAD_PARAMETER error is generated if num config is NULL." We have to check for the condition and return the required error to application for eglGetConfigs and eglGetConfigs functions. Test: refactoring CL. Change-Id: Ib42709f0420161ce661536394d4c0779bc62be57 Signed-off-by: Pauli Nieminen Signed-off-by: Liu Zhiquan --- opengl/libagl/egl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'opengl/libagl/egl.cpp') diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index c1efd1cae6..9c3071472d 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -1459,6 +1459,9 @@ EGLBoolean eglGetConfigs( EGLDisplay dpy, if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); + if (ggl_unlikely(num_config==NULL)) + return setError(EGL_BAD_PARAMETER, EGL_FALSE); + GLint numConfigs = NELEM(gConfigs); if (!configs) { *num_config = numConfigs; @@ -1478,8 +1481,8 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - - if (ggl_unlikely(num_config==0)) { + + if (ggl_unlikely(num_config==NULL)) { return setError(EGL_BAD_PARAMETER, EGL_FALSE); } -- cgit v1.2.3-59-g8ed1b