st/mesa: Fix signed integer overflow when using util_throttle_memory_usage

../src/mesa/state_tracker/st_cb_texture.c:1719:57: runtime error: signed integer overflow: 203489280 * 16 cannot be represented in type 'int'

Fixes: 21ca322e63
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4185>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4185>
This commit is contained in:
Danylo Piliaiev 2020-03-13 17:10:08 +02:00 committed by Marge Bot
parent b93a195225
commit 51b1b102bd

View file

@ -1511,7 +1511,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
}
util_throttle_memory_usage(pipe, &st->throttle,
width * height * depth *
(uint64_t) width * height * depth *
util_format_get_blocksize(dst->format));
u_box_3d(xoffset, yoffset, zoffset + dstz, width, height, depth, &box);
@ -1620,7 +1620,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
}
util_throttle_memory_usage(pipe, &st->throttle,
width * height * depth *
(uint64_t) width * height * depth *
util_format_get_blocksize(src_templ.format));
throttled = true;
@ -1716,7 +1716,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
fallback:
if (!throttled) {
util_throttle_memory_usage(pipe, &st->throttle,
width * height * depth *
(uint64_t) width * height * depth *
_mesa_get_format_bytes(texImage->TexFormat));
}
_mesa_store_texsubimage(ctx, dims, texImage, xoffset, yoffset, zoffset,