Mesa (master): u_blitter: check for invalid values in copy_buffer
Marek Olšák
mareko at kemper.freedesktop.org
Fri Feb 24 01:31:23 UTC 2012
Module: Mesa
Branch: master
Commit: 59fbd8c6bea1a6420b6fe3bb75d1ea64c054a8b3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=59fbd8c6bea1a6420b6fe3bb75d1ea64c054a8b3
Author: Marek Olšák <maraeo at gmail.com>
Date: Fri Feb 24 02:24:22 2012 +0100
u_blitter: check for invalid values in copy_buffer
---
src/gallium/auxiliary/util/u_blitter.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 6a32de6..be420ec 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1247,6 +1247,17 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
struct pipe_vertex_buffer vb;
struct pipe_stream_output_target *so_target;
+ if (srcx >= src->width0 ||
+ dstx >= dst->width0) {
+ return;
+ }
+ if (srcx + size > src->width0) {
+ size = src->width0 - srcx;
+ }
+ if (dstx + size > dst->width0) {
+ size = dst->width0 - dstx;
+ }
+
/* Drivers not capable of Stream Out should not call this function
* in the first place. */
assert(ctx->has_stream_out);
More information about the mesa-commit
mailing list