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 <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22720>
(cherry picked from commit 79b3828e82)
This commit is contained in:
Mike Blumenkrantz 2023-04-26 15:37:31 -04:00 committed by Eric Engestrom
parent 664eada4e9
commit 2d24f535ae
2 changed files with 2 additions and 2 deletions

View file

@ -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
},

View file

@ -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;