summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-06-08 22:12:23 -0700
committerKenneth Graunke <kenneth@whitecape.org>2012-06-11 13:27:36 -0700
commita75e704326986b85539b6abf2319701e1a3138e9 (patch)
tree6378c9f229c482e12f98ac57f8bd9e145c5f8262 /src/mesa/main/bufferobj.c
parent4a5d020ee39576660f72283714822192294323b8 (diff)
mesa: Check for a negative "size" parameter in glCopyBufferSubData().
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. NOTE: This is a candidate for stable release branches. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r--src/mesa/main/bufferobj.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 54156650974..846260d80fe 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)",