u_blitter: check for invalid values in copy_buffer

This commit is contained in:
Marek Olšák 2012-02-24 02:24:22 +01:00
parent df00dc3c81
commit 59fbd8c6be

View file

@ -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);