From 6f5f003e2b1c360a6cc99f4a234aea1ae9672424 Mon Sep 17 00:00:00 2001 From: Maxime Wack Date: Mon, 10 Aug 2020 22:42:46 +0200 Subject: [PATCH] Fix possible division by zero in radius calculation. Check all possible causes of division by zero in the calculation of the radius. --- src/draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/draw.c b/src/draw.c index 0fde227..6a23f43 100644 --- a/src/draw.c +++ b/src/draw.c @@ -412,7 +412,7 @@ static int layout_get_height(struct colored_layout *cl) */ static int frame_internal_radius (int r, int w, int h) { - if (r == 0 || w == 0 || h == 0) + if (r == 0 || h + (w - r) * 2 == 0) return 0; // Integer precision scaler, using 1/4 of int size