[Mesa-dev] [PATCH] Fix zero-division in llvmpipe_texture_layout()

Johannes Obermayr johannesobermayr at gmx.de
Sat Jun 7 11:38:32 PDT 2014


From: Takashi Iwai <tiwai at suse.de>

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

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

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
To: mesa-dev at lists.freedesktop.org
Cc: "10.2" <mesa-stable at lists.freedesktop.org>
Takashi: Please send also a proper patch to mesa-dev and mesa-stable next time ...
---
 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..5ab2559 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 (nblocksy && lpr->row_stride[level] > LP_MAX_TEXTURE_SIZE / nblocksy) {
             /* image too large */
             goto fail;
          }
-- 
1.8.4.5



More information about the mesa-dev mailing list