This method returns size_t, but the multiplication multiplies two
integers, leading to overflow rather than type widening.
Noticed by compiling with MSVC, which emits a warning.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
util_format_get_stride(enum pipe_format format,
unsigned width)
{
- return util_format_get_nblocksx(format, width) * util_format_get_blocksize(format);
+ return (size_t)util_format_get_nblocksx(format, width) * util_format_get_blocksize(format);
}
static inline size_t