File CVE-2021-4216.patch of Package mupdf.17658
From 22c47acbd52949421f8c7cb46ea1556827d0fcbf Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen <sebras@gmail.com> Date: Tue, 18 Jan 2022 20:33:10 +0100 Subject: [PATCH] Bug 704834: Fix division by zero for zero width pages in muraster. --- source/tools/muraster.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- mupdf-1.12.0-source.orig/source/tools/muraster.c +++ mupdf-1.12.0-source/source/tools/muraster.c @@ -965,8 +965,9 @@ initialise_banding(fz_context *ctx, rend w = render->ibounds.x1 - render->ibounds.x0; min_band_mem = bpp * w * min_band_height; - reps = (int)(max_band_memory / min_band_mem); - if (reps < 1) + if (min_band_mem > 0) + reps = (int)(max_band_memory / min_band_mem); + if (min_band_mem == 0 || reps < 1) reps = 1; /* Adjust reps to even out the work between threads */