aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorDanylo Piliaiev <[email protected]>2020-03-13 17:10:08 +0200
committerMarge Bot <[email protected]>2020-03-16 10:10:13 +0000
commit51b1b102bd619b6a802807bde5f5228c1dabd1d7 (patch)
tree2f1cd6d546653332c7ad48cb09927db8e5662696 /src/mesa/state_tracker
parentb93a1952258ebef6319fd4f4186d704e04b3064c (diff)
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: 21ca322e637291b89a445159fc45b8dbf638e6c9 Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4185> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4185>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 88951f5059d..d5dd61935bc 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -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,