OSDN Git Service

Handle NULL 'value' to eglGetSyncAttribKHR()
authorAlistair Strachan <astrachan@google.com>
Wed, 27 Mar 2019 08:54:12 +0000 (17:54 +0900)
committerAlistair Strachan <astrachan@google.com>
Wed, 27 Mar 2019 20:58:50 +0000 (20:58 +0000)
The EGL spec does not specifically call out how to handle the case
where 'value' passed to eglGetSyncAttribKHR is NULL, however many
implementations will set the context error to EGL_BAD_PARAMETER
and return without crashing. dEQP has a test which specifically
checks for this behavior. Align SwiftShader's implementation with
other EGL implementations.

Bug: b/74572503
Test: dEQP-EQL GetSyncInvalidValueTest
Change-Id: Ic893cd7073c12c463ded78042031df1bf85f6ce2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28028
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
src/OpenGL/libEGL/libEGL.cpp

index ffbe929..912fe0c 100644 (file)
@@ -1417,6 +1417,11 @@ EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLA
                return error(EGL_BAD_PARAMETER, EGL_FALSE);
        }
 
+       if(!value)
+       {
+               return error(EGL_BAD_PARAMETER, EGL_FALSE);
+       }
+
        switch(attribute)
        {
        case EGL_SYNC_TYPE_KHR: