Mesa (master): i965: Add a safety check for emitting blits.

Eric Anholt anholt at kemper.freedesktop.org
Thu Jan 9 08:02:33 UTC 2014


Module: Mesa
Branch: master
Commit: 98cdb2ceede34ad04cd8f65691bd96fbb44bcced
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=98cdb2ceede34ad04cd8f65691bd96fbb44bcced

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Dec 23 01:26:56 2013 -0800

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 <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>

---

 src/mesa/drivers/dri/i965/intel_blit.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 13cc777..9162b1f 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);
 




More information about the mesa-commit mailing list