summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-05-14 10:18:23 -0700
committerIan Romanick <ian.d.romanick@intel.com>2012-05-18 16:08:34 -0700
commitb5b65af5fa0f9de5fc4af8fbfe7ca9ebe8c871a3 (patch)
tree72ef2b160647cd6ae6215916096ffecee5c08cef
parente0e8f1efada825cff290895e5fc3b4ca957b68f7 (diff)
mesa: Check for framebuffer completeness before looking at the rb.
Otherwise, an incomplete framebuffer could have a NULL _ColorReadBuffer and we'd deref that. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit 5a827d9a2b5d698fed98a5d62ff0292b48bdd6c7)
-rw-r--r--src/mesa/main/readpix.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index b9c93510379..6c041fa92c9 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -819,6 +819,12 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
+ if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+ "glReadPixels(incomplete framebuffer)" );
+ return;
+ }
+
/* Check that the destination format and source buffer are both
* integer-valued or both non-integer-valued.
*/
@@ -833,12 +839,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glReadPixels(incomplete framebuffer)" );
- return;
- }
-
if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
return;