Mesa (master): softpipe: added region assertions in softpipe_get_tex_transfer()

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 21 15:26:53 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan 20 17:40:48 2010 -0700

softpipe: added region assertions in softpipe_get_tex_transfer()

---

 src/gallium/drivers/softpipe/sp_texture.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index fae72c8..45e80c5 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -291,6 +291,10 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
    assert(texture);
    assert(level <= texture->last_level);
 
+   /* make sure the requested region is in the image bounds */
+   assert(x + w <= u_minify(texture->width0, level));
+   assert(y + h <= u_minify(texture->height0, level));
+
    spt = CALLOC_STRUCT(softpipe_transfer);
    if (spt) {
       struct pipe_transfer *pt = &spt->base;




More information about the mesa-commit mailing list