Module: Mesa
Branch: main
Commit: 79b3828e829821d87ba5141f9bff10643afefb84
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=79b3828e829821d87ba5141f9bff10643afefb84

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Apr 26 15:37:31 2023 -0400

draw: fix robust ubo size calc

if the size of the constant buffer + stride overflows UINT32_MAX,
DIV_ROUND_UP will return 0, which is, in some sense, extremely robust,
but for general functionality it's not actually very robust

cc: mesa-stable

Reviewed-by: Konstantin Seurer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22720>

---

 src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c 
b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index 2df7c53a8f0..7cbb2e22db9 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -406,7 +406,7 @@ llvm_middle_end_prepare(struct draw_pt_middle_end *middle,
 static unsigned
 get_num_consts_robust(struct draw_context *draw, unsigned *sizes, unsigned idx)
 {
-   unsigned const_bytes = sizes[idx];
+   uint64_t const_bytes = sizes[idx];
 
    if (const_bytes < sizeof(float))
       return 0;

Reply via email to