mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 11:08:03 +02:00
tc: fix potential overflows
Reported by static analysis. Multiplication may overflow before being converted to the larger type, so fix this by casting one of the operands to the destination type. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35877>
This commit is contained in:
parent
8731293170
commit
bd625f7453
1 changed files with 4 additions and 1 deletions
|
|
@ -3183,13 +3183,16 @@ tc_texture_subdata(struct pipe_context *_pipe,
|
|||
{
|
||||
struct threaded_context *tc = threaded_context(_pipe);
|
||||
uint64_t size;
|
||||
uint32_t last_row_stride;
|
||||
|
||||
assert(box->height >= 1);
|
||||
assert(box->depth >= 1);
|
||||
|
||||
last_row_stride = box->width * util_format_get_blocksize(resource->format);
|
||||
|
||||
size = (box->depth - 1) * layer_stride +
|
||||
(box->height - 1) * (uint64_t)stride +
|
||||
box->width * util_format_get_blocksize(resource->format);
|
||||
last_row_stride;
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue