From 2d24f535ae3bf0d1fa625af844331f3f497f7ca8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 26 Apr 2023 15:37:31 -0400 Subject: [PATCH] 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 Part-of: (cherry picked from commit 79b3828e829821d87ba5141f9bff10643afefb84) --- .pick_status.json | 2 +- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index cb46976a970..4330dbfd8e3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -913,7 +913,7 @@ "description": "draw: fix robust ubo size calc", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, 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;