From ba3671d147cce84e2c279c92513fe8be68c523d8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 4 Nov 2014 20:34:42 +0000 Subject: ensure gtk thumbnail content has a minimum render width. (fix coverity 1109861) --- gtk/thumbnail.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gtk') diff --git a/gtk/thumbnail.c b/gtk/thumbnail.c index 4bdab7485..89fc45fdc 100644 --- a/gtk/thumbnail.c +++ b/gtk/thumbnail.c @@ -70,11 +70,12 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, dheight = cairo_image_surface_get_height(dsurface); /* Calculate size of buffer to render the content into */ - /* We get the width from the content width, unless it exceeds 1024, + /* Get the width from the content width, unless it exceeds 1024, * in which case we use 1024. This means we never create excessively * large render buffers for huge contents, which would eat memory and - * cripple performance. */ - cwidth = min(content_get_width(content), 1024); + * cripple performance. + */ + cwidth = min(max(content_get_width(content), dwidth), 1024); /* The height is set in proportion with the width, according to the * aspect ratio of the required thumbnail. */ -- cgit v1.2.3