[Mesa-dev] [PATCH 13/13] anv: Improve the asserts in anv_buffer_get_range

Jason Ekstrand jason at jlekstrand.net
Sat Oct 13 13:10:00 UTC 2018


---
 src/intel/vulkan/anv_private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index b897d679533..f30ffb36179 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1681,7 +1681,8 @@ anv_buffer_get_range(struct anv_buffer *buffer, uint64_t offset, uint64_t range)
    if (range == VK_WHOLE_SIZE) {
       return buffer->size - offset;
    } else {
-      assert(range <= buffer->size);
+      assert(range + offset >= range);
+      assert(range + offset <= buffer->size);
       return range;
    }
 }
-- 
2.19.1



More information about the mesa-dev mailing list