[Piglit] [PATCH] get-active-attrib-array: allocate a sufficiently large buffer

Brian Paul brianp at vmware.com
Wed Feb 22 19:10:56 UTC 2017


Reviewed-by: Brian Paul <brianp at vmware.com>


On 02/22/2017 12:07 PM, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Found by ASAN.
> ---
>   tests/spec/glsl-1.50/execution/get-active-attrib-array.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/glsl-1.50/execution/get-active-attrib-array.c b/tests/spec/glsl-1.50/execution/get-active-attrib-array.c
> index e2d4e64..e11ed6c 100644
> --- a/tests/spec/glsl-1.50/execution/get-active-attrib-array.c
> +++ b/tests/spec/glsl-1.50/execution/get-active-attrib-array.c
> @@ -71,21 +71,21 @@ piglit_display(void)
>    * Find the given attribute size then, check if the passed expected size
>    * is equal to the actual size.
>    */
>   bool
>   getAttribLocTest(GLint program, int active_attribs, int max_name_length,
>   		char *attrib_name, int expected_size)
>   {
>   	bool pass = true;
>   	int size = -1;
>   	GLenum type = GL_NONE;
> -	char *name = malloc(max_name_length-1);
> +	char *name = malloc(max_name_length);
>
>   	int i;
>   	for(i = 0; i < active_attribs; i++) {
>   		glGetActiveAttrib(program, i, max_name_length,
>   				  NULL, &size, &type, name);
>
>   		if(strcmp(attrib_name, name) == 0) {
>   			break;
>   		}
>   	}
>



More information about the Piglit mailing list