[Piglit] [PATCH] arb_internalformat_query-minmax: initialise buffer_size_in_elements

Ian Romanick idr at freedesktop.org
Wed Apr 17 09:56:44 PDT 2013


On 04/16/2013 06:33 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Since we never bail on the first failure in this test, we can return
> from the GetInternalformativ without buffer_size_in_elements ever
> being touched, due to misc GL error (mesa_base_fbo_format fails),
> this then causes us to loop a lot later and print error messages
> than make piglit eat all the pies^WRAM.

So... the underlying problem is the first call to glGetInternalformativ 
generates and error and doesn't write to buffer_size_in_elements.  Then 
the call to malloc indirectly uses buffer_size_in_elements to size the 
allocation, and it gets used as a loop count after that.  Uninitialized 
data is bad, m'kay.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>   tests/spec/arb_internalformat_query/minmax.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tests/spec/arb_internalformat_query/minmax.c b/tests/spec/arb_internalformat_query/minmax.c
> index 2f8043d..c15b954 100644
> --- a/tests/spec/arb_internalformat_query/minmax.c
> +++ b/tests/spec/arb_internalformat_query/minmax.c
> @@ -103,7 +103,7 @@ try(GLenum target, GLenum format, GLint max_samples,
>   {
>   	bool pass = true;
>   	GLint *buffer;
> -	int buffer_size_in_elements;
> +	int buffer_size_in_elements = 0;
>   	size_t buffer_size_in_bytes;
>   	unsigned i;
>   	GLint previous;
>



More information about the Piglit mailing list