summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-02-24 02:24:22 +0100
committerMarek Olšák <[email protected]>2012-02-24 02:28:54 +0100
commit59fbd8c6bea1a6420b6fe3bb75d1ea64c054a8b3 (patch)
tree97f7d847e33ad886d9b89aa5275d6099adbdcf9d /src
parentdf00dc3c817771ac5034a44dff2b14cd7759b207 (diff)
u_blitter: check for invalid values in copy_buffer
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c11
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 6a32de619ef..be420ec1556 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);