Skip to content

Commit 184d50f

Browse files
author
Naomi Luis
committed
frameworks/base/opengl: Add NULL check
Check for the validity of the attrs_list in eglChooseConfig before using it. This avoids a crash during tests in which the attributes are NULL. Change-Id: I1c0a46b505ae919e2454cfdce32f8dfc21ead247
1 parent 0f0dd44 commit 184d50f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

opengl/libs/EGL/egl.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,13 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
843843
EGLint patch_index = -1;
844844
GLint attr;
845845
size_t size = 0;
846-
while ((attr=attrib_list[size]) != EGL_NONE) {
847-
if (attr == EGL_CONFIG_ID)
848-
patch_index = size;
849-
size += 2;
846+
847+
if (attrib_list != NULL) {
848+
while ((attr=attrib_list[size]) != EGL_NONE) {
849+
if (attr == EGL_CONFIG_ID)
850+
patch_index = size;
851+
size += 2;
852+
}
850853
}
851854
if (patch_index >= 0) {
852855
size += 2; // we need copy the sentinel as well

0 commit comments

Comments
 (0)