aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-12-23 01:26:56 -0800
committerEric Anholt <[email protected]>2014-01-09 15:23:23 +0800
commit98cdb2ceede34ad04cd8f65691bd96fbb44bcced (patch)
tree2de481cd1dc96dd9a1bd129d516cd6bc8ad44092 /src/mesa
parentbdc5241af4aa9afbd66f6c96ee6d20e09f77ea89 (diff)
i965: Add a safety check for emitting blits.
With all of the flipping and pitch twiddling and miptree layout involved in our blits, there are lots of ways for us to scribble outside of a buffer. Put in a check that we're not about to do so. This catches a bug that glamor was running into. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/intel_blit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 13cc77792e4..9162b1fc336 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -391,6 +391,10 @@ intelEmitCopyBlit(struct brw_context *brw,
assert(dst_x < dst_x2);
assert(dst_y < dst_y2);
+ assert(src_offset + (src_y + h - 1) * abs(src_pitch) +
+ (w * cpp) <= src_buffer->size);
+ assert(dst_offset + (dst_y + h - 1) * abs(dst_pitch) +
+ (w * cpp) <= dst_buffer->size);
BEGIN_BATCH_BLT_TILED(8, dst_y_tiled, src_y_tiled);