gallium: Ensure map ranges are valid.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 4 Mar 2009 16:07:51 +0000 (16:07 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 4 Mar 2009 16:07:51 +0000 (16:07 +0000)
src/gallium/include/pipe/p_inlines.h

index 1f46461043e6b8f9d6c780a174fe30db7f1ab21a..4e5252dfbe0ac5b553f379a73c69b0265b9594a9 100644 (file)
@@ -83,6 +83,8 @@ pipe_buffer_map_range(struct pipe_screen *screen,
                 unsigned length,
                 unsigned usage)
 {
+   assert(offset < buf->size);
+   assert(offset + length <= buf->size);
    if(screen->buffer_map_range)
       return screen->buffer_map_range(screen, buf, offset, length, usage);
    else {
@@ -98,6 +100,8 @@ pipe_buffer_flush_mapped_range(struct pipe_screen *screen,
                                unsigned offset,
                                unsigned length)
 {
+   assert(offset < buf->size);
+   assert(offset + length <= buf->size);
    if(screen->buffer_flush_mapped_range)
       screen->buffer_flush_mapped_range(screen, buf, offset, length);
 }