[Mesa-dev] [PATCH] mesa: Check for a negative "size" parameter in glCopyBufferSubData().

Brian Paul brian.e.paul at gmail.com
Sat Jun 9 17:34:40 CEST 2012


On Fri, Jun 8, 2012 at 11:18 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> From the GL_ARB_copy_buffer spec:
> "An INVALID_VALUE error is generated if any of readoffset, writeoffset,
>  or size are negative [...]"
>
> Fixes oglconform's copybuffer/negative.CNNegativeValues test.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/main/bufferobj.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 5415665..846260d 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -1360,6 +1360,12 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
>       return;
>    }
>
> +   if (size < 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glCopyBufferSubData(writeOffset = %d)", (int) size);
> +      return;
> +   }
> +
>    if (readOffset + size > src->Size) {
>       _mesa_error(ctx, GL_INVALID_VALUE,
>                   "glCopyBufferSubData(readOffset + size = %d)",
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


More information about the mesa-dev mailing list