From: Marek Olšák Date: Fri, 24 Feb 2012 01:24:22 +0000 (+0100) Subject: u_blitter: check for invalid values in copy_buffer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59fbd8c6bea1a6420b6fe3bb75d1ea64c054a8b3;p=mesa.git u_blitter: check for invalid values in copy_buffer --- 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);