Initialize variables for error tests
authorJames Helferty <jhelferty@nvidia.com>
Thu, 27 Jul 2017 15:37:55 +0000 (11:37 -0400)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 18 Aug 2017 08:13:22 +0000 (04:13 -0400)
This set of tests intentionally provides erroneous call arguments in
order to generate GL errors. As a result, the GL functions' output
arguments won't always be written to. The problem is, we bounce these
functions through CallLogWrapper, which expects the output arguments
to have valid contents, and will attempt to log them to file,
potentially resulting in unexpected process termination.

This change initializes the output arguments beforehand to valid values
so that CallLogWrapper doesn't unintentionally access invalid memory.

VK-GL-CTS issue 603

Components: OpenGL

Affects:
* KHR-GLES31.core.program_interface_query.invalid-enum
* KHR-GLES31.core.program_interface_query.invalid-operation
* KHR-GLES31.core.program_interface_query.invalid-value
* KHR-GL43/44/45.program_interface_query.invalid-enum
* KHR-GL43/44/45.program_interface_query.invalid-operation
* KHR-GL43/44/45.program_interface_query.invalid-value

Change-Id: I5fae2d4505e9c70cbcb2fbd11bdf900c0b4c751a

external/openglcts/modules/gl/gl4cProgramInterfaceQueryTests.cpp

index 8bfd856..648aea0 100644 (file)
@@ -2748,8 +2748,8 @@ class InvalidValueTest : public SimpleShaders
        {
                long error = NO_ERROR;
 
-               GLint   res;
-               GLsizei len;
+               GLint   res = 0;
+               GLsizei len = 0;
                GLchar  name[100] = { '\0' };
                GLenum  props[1]  = { GL_NAME_LENGTH };
 
@@ -2833,8 +2833,8 @@ class InvalidEnumTest : public AtomicCounterSimple
 
                long error = NO_ERROR;
 
-               GLint   res;
-               GLsizei len;
+               GLint   res = 0;
+               GLsizei len = 0;
                GLchar  name[100] = { '\0' };
                GLenum  props[1]  = { GL_TEXTURE_1D };
 
@@ -2895,8 +2895,8 @@ class InvalidOperationTest : public SimpleShaders
                LinkProgram(program);
 
                const GLuint sh = glCreateShader(GL_FRAGMENT_SHADER);
-               GLint            res;
-               GLsizei          len;
+               GLint            res = 0;
+               GLsizei          len = 0;
                GLchar           name[100] = { '\0' };
                GLenum           props[1]  = { GL_OFFSET };