Mesa (10.2): llvmpipe: Fix zero-division in llvmpipe_texture_layout()

Carl Worth cworth at kemper.freedesktop.org
Fri Jul 4 04:07:35 UTC 2014


Module: Mesa
Branch: 10.2
Commit: 9bd6dc9371d0665e0b4a1f7ea4681c683351b58c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bd6dc9371d0665e0b4a1f7ea4681c683351b58c

Author: Takashi Iwai <tiwai at suse.de>
Date:   Wed Jun 25 02:03:07 2014 +0200

llvmpipe: Fix zero-division in llvmpipe_texture_layout()

Fix the crash of "gnome-control-center info" invocation on QEMU where
zero height is passed at init.

(sroland: simplify logic by eliminating the div altogether, using 64bit mul.)

Fixes: https://bugzilla.novell.com/show_bug.cgi?id=879462

Cc: "10.2" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit 6b8b17153ab27b2bc7221df974a5872805f528b1)

---

 src/gallium/drivers/llvmpipe/lp_texture.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index f601181..6df88d0 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -115,7 +115,7 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
             lpr->row_stride[level] = align(nblocksx * block_size, util_cpu_caps.cacheline);
 
          /* if row_stride * height > LP_MAX_TEXTURE_SIZE */
-         if (lpr->row_stride[level] > LP_MAX_TEXTURE_SIZE / nblocksy) {
+         if ((uint64_t)lpr->row_stride[level] * nblocksy > LP_MAX_TEXTURE_SIZE) {
             /* image too large */
             goto fail;
          }




More information about the mesa-commit mailing list