Mesa (9.1): mesa: fix type comparison errors in sub-texture error checking code
Ian Romanick
idr at kemper.freedesktop.org
Wed May 29 20:37:33 UTC 2013
Module: Mesa
Branch: 9.1
Commit: 870c357847b5b79e1c7f81aa289990ca6bc30fe0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=870c357847b5b79e1c7f81aa289990ca6bc30fe0
Author: Tapani Pälli <tapani.palli at intel.com>
Date: Thu Apr 18 09:21:27 2013 +0300
mesa: fix type comparison errors in sub-texture error checking code
patch fixes a crash that happens if glTexSubImage2D is called with a
negative xoffset.
NOTE: This is a candidate for stable branches.
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit 12b0bfa6e92795b4f9c57950ce6c1986618b14b5)
---
src/mesa/main/teximage.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 1b91b89..f95807c 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1478,13 +1478,13 @@ error_check_subtexture_dimensions(struct gl_context *ctx,
}
/* check xoffset and width */
- if (xoffset < -destImage->Border) {
+ if (xoffset < - (GLint) destImage->Border) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset)",
function, dims);
return GL_TRUE;
}
- if (xoffset + subWidth > destImage->Width) {
+ if (xoffset + subWidth > (GLint) destImage->Width) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset+width)",
function, dims);
return GL_TRUE;
@@ -1498,7 +1498,7 @@ error_check_subtexture_dimensions(struct gl_context *ctx,
function, dims);
return GL_TRUE;
}
- if (yoffset + subHeight > destImage->Height) {
+ if (yoffset + subHeight > (GLint) destImage->Height) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(yoffset+height)",
function, dims);
return GL_TRUE;
@@ -1537,13 +1537,13 @@ error_check_subtexture_dimensions(struct gl_context *ctx,
}
/* size must be multiple of bw by bh or equal to whole texture size */
- if ((subWidth % bw != 0) && subWidth != destImage->Width) {
+ if ((subWidth % bw != 0) && subWidth != (GLint) destImage->Width) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s%dD(width = %d)", function, dims, subWidth);
return GL_TRUE;
}
- if ((subHeight % bh != 0) && subHeight != destImage->Height) {
+ if ((subHeight % bh != 0) && subHeight != (GLint) destImage->Height) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s%dD(height = %d)", function, dims, subHeight);
return GL_TRUE;
More information about the mesa-commit
mailing list