summaryrefslogtreecommitdiff
path: root/gtk/thumbnail.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-11-04 20:34:42 +0000
committerVincent Sanders <vince@kyllikki.org>2014-11-04 20:41:31 +0000
commitba3671d147cce84e2c279c92513fe8be68c523d8 (patch)
treee8651857337b6c063986e0a224d1c6ef3cc87429 /gtk/thumbnail.c
parentb4f3eaf082064cdebd6951e95b2e26d10a384ab9 (diff)
downloadnetsurf-ba3671d147cce84e2c279c92513fe8be68c523d8.tar.gz
netsurf-ba3671d147cce84e2c279c92513fe8be68c523d8.tar.bz2
ensure gtk thumbnail content has a minimum render width. (fix coverity 1109861)
Diffstat (limited to 'gtk/thumbnail.c')
-rw-r--r--gtk/thumbnail.c7
1 files changed, 4 insertions, 3 deletions
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. */