From 9b463ac36d418a1e4e23e95fca82aa4862203c38 Mon Sep 17 00:00:00 2001 From: veltza <106755522+veltza@users.noreply.github.com> Date: Tue, 2 Apr 2024 21:05:32 +0300 Subject: [PATCH] sixel: prevent crashing when size is zero (#129) Crashing happens when you zoom out and the width or height of an image becomes zero. --- x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x.c b/x.c index cfa4411..7e9f972 100644 --- a/x.c +++ b/x.c @@ -3145,8 +3145,8 @@ xfinishdraw(void) continue; /* scale the image */ - width = im->width * win.cw / im->cw; - height = im->height * win.ch / im->ch; + width = MAX(im->width * win.cw / im->cw, 1); + height = MAX(im->height * win.ch / im->ch, 1); if (!im->pixmap) { im->pixmap = (void *)XCreatePixmap(xw.dpy, xw.win, width, height, #if ALPHA_PATCH