Module: Mesa Branch: master Commit: eb081681df248750727a8a76436760d617b4a6a9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb081681df248750727a8a76436760d617b4a6a9
Author: Ilia Mirkin <[email protected]> Date: Tue Sep 15 19:32:10 2015 -0400 st/mesa: avoid integer overflows with buffers >= 512MB This fixes failures with the newly-submitted max-size texture buffer piglit test for GPUs exposing >= 128M max texels. Signed-off-by: Ilia Mirkin <[email protected]> Cc: "10.6 11.0" <[email protected]> Reviewed-by: Glenn Kennard <[email protected]> --- src/mesa/state_tracker/st_atom_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 31e0f6b..3e37752 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -274,8 +274,8 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, return NULL; size = MIN2(stObj->pt->width0 - base, (unsigned)stObj->base.BufferSize); - f = ((base * 8) / desc->block.bits) * desc->block.width; - n = ((size * 8) / desc->block.bits) * desc->block.width; + f = (base / (desc->block.bits / 8)) * desc->block.width; + n = (size / (desc->block.bits / 8)) * desc->block.width; if (!n) return NULL; templ.u.buf.first_element = f; _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
