Commit 24e39699 by apatrick@chromium.org

Fixed null dereference when null passed as attribute list to eglCreateContext.

I tested that the samples still work and that they fail as expected, but do not crash, if the attribute list argument is null. Review URL: http://codereview.appspot.com/2725042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@471 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 91ed1494
...@@ -774,15 +774,18 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte ...@@ -774,15 +774,18 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
{ {
// Get the requested client version (default is 1) and check it is two. // Get the requested client version (default is 1) and check it is two.
EGLint client_version = 1; EGLint client_version = 1;
for (const EGLint* attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2) if (attrib_list)
{ {
if (attribute[0] == EGL_CONTEXT_CLIENT_VERSION) for (const EGLint* attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2)
{
client_version = attribute[1];
}
else
{ {
return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT); if (attribute[0] == EGL_CONTEXT_CLIENT_VERSION)
{
client_version = attribute[1];
}
else
{
return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment