Mesa (master): intel: Assert that relocation offsets are within the target

Chris Wilson ickle at kemper.freedesktop.org
Sat Oct 3 22:11:52 UTC 2009


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

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct  2 19:46:03 2009 +0100

intel: Assert that relocation offsets are within the target

This should catch the common programming error where we attempt to
emit a relocation to beyond the end of the target buffer.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 51579df..9a619fb 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -157,7 +157,7 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
 #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
 
 #define OUT_RELOC(buf, read_domains, write_domain, delta) do {		\
-   assert((delta) >= 0);						\
+   assert((unsigned) (delta) <= buf->size);				\
    intel_batchbuffer_emit_reloc(intel->batch, buf,			\
 				read_domains, write_domain, delta);	\
 } while (0)




More information about the mesa-commit mailing list