From a18de3948f78ae19518253e01ca6a8624e2304da Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Sun, 17 Jul 2011 07:42:14 +0400 Subject: [PATCH] st/mesa: clip src size to strb size in st_copy_texsubimage --- src/mesa/state_tracker/st_cb_texture.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 6907cfc..63cd142 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1490,6 +1490,14 @@ st_copy_texsubimage(struct gl_context *ctx, destY = 0; } + if (srcX + width > strb->Base.Width) { + width = strb->Base.Width - srcX; + } + + if (srcY + height > strb->Base.Height) { + height = strb->Base.Height - srcY; + } + if (width < 0 || height < 0) return; -- 1.7.6