Mesa (master): mesa: Fix off-by-one error in transform feedback size check.

Paul Berry stereotype441 at kemper.freedesktop.org
Tue Dec 20 23:41:21 UTC 2011


Module: Mesa
Branch: master
Commit: 38b118d49ddbc8bd5d96cc0d23d681887fca045e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=38b118d49ddbc8bd5d96cc0d23d681887fca045e

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Thu Dec  8 11:23:22 2011 -0800

mesa: Fix off-by-one error in transform feedback size check.

In _mesa_BindBufferRange(), we need to verify that the offset and size
specified by the client do not exceed the size of the underlying
buffer.  We were accidentally doing this check using ">=" rather than
">", so we were generating a bogus error if the client specified an
offset and size that fit exactly in the underlying buffer.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/transformfeedback.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 824f66a..b0b75ea 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -473,7 +473,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
       return;
    }
 
-   if (offset + size >= bufObj->Size) {
+   if (offset + size > bufObj->Size) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "glBindBufferRange(offset + size %d > buffer size %d)",
 		  (int) (offset + size), (int) (bufObj->Size));




More information about the mesa-commit mailing list