From 58fee8749ffe41b0bb7c71456eddb808cbde8821 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 3 Oct 2020 14:25:43 +0100 Subject: gtk/bitmap: Assert surface width/height non-zero Signed-off-by: Daniel Silverstone --- frontends/gtk/bitmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontends/gtk/bitmap.c b/frontends/gtk/bitmap.c index 36b614cf9..e7b859d06 100644 --- a/frontends/gtk/bitmap.c +++ b/frontends/gtk/bitmap.c @@ -478,6 +478,10 @@ bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content) * aspect ratio of the required thumbnail. */ cheight = ((cwidth * dheight) + (dwidth / 2)) / dwidth; + /* At this point, we MUST have decided to render something non-zero sized */ + assert(cwidth > 0); + assert(cheight > 0); + /* Create surface to render into */ surface = cairo_surface_create_similar(dsurface, CAIRO_CONTENT_COLOR_ALPHA, cwidth, cheight); -- cgit v1.2.1