[Mesa-dev] [Mesa-stable] [PATCH] st/mesa: don't clobber glGetInternalformat* buffer for GL_NUM_SAMPLE_COUNTS
Marek Olšák
maraeo at gmail.com
Fri Oct 6 22:22:53 UTC 2017
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Fri, Oct 6, 2017 at 10:13 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Applications might pass in a buffer that is sized too large and rely
> on the extra space of the buffer not being overwritten.
>
> Fixes dEQP-GLES31.functional.state_query.internal_format.partial_query.num_sample_counts
>
> Cc: mesa-stable at lists.freedesktop.org
> ---
> src/mesa/state_tracker/st_format.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
> index 5e38fe56890..65be09cbde2 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -2371,23 +2371,24 @@ st_QueryInternalFormat(struct gl_context *ctx, GLenum target,
> * and guaranteed to have at least 16 elements.
> */
> assert(params != NULL);
>
> switch (pname) {
> case GL_SAMPLES:
> st_QuerySamplesForFormat(ctx, target, internalFormat, params);
> break;
>
> case GL_NUM_SAMPLE_COUNTS: {
> + int samples[16];
> size_t num_samples;
> num_samples = st_QuerySamplesForFormat(ctx, target, internalFormat,
> - params);
> + samples);
> params[0] = (GLint) num_samples;
> break;
> }
> case GL_INTERNALFORMAT_PREFERRED: {
> params[0] = GL_NONE;
>
> /* We need to resolve an internal format that is compatible with
> * the passed internal format, and optimal to the driver. By now,
> * we just validate that the passed internal format is supported by
> * the driver, and if so return the same internal format, otherwise
> --
> 2.11.0
>
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-stable
More information about the mesa-dev
mailing list