summaryrefslogtreecommitdiff
path: root/libappstream-builder/asb-app.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-12-12 21:03:50 +0000
committerRichard Hughes <richard@hughsie.com>2014-12-12 21:04:20 +0000
commit3f32721f677dbdc5aa51ab717198a03e01c5baeb (patch)
treeb6da9023b9051fc5efe8380ac72ce5a857795bc2 /libappstream-builder/asb-app.c
parentebb72026f007e21dd166507a9702846a6967e751 (diff)
downloadappstream-glib-3f32721f677dbdc5aa51ab717198a03e01c5baeb.tar.gz
Check screenshots are a reasonable size
We don't want to pad out 75% of the image size...
Diffstat (limited to 'libappstream-builder/asb-app.c')
-rw-r--r--libappstream-builder/asb-app.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libappstream-builder/asb-app.c b/libappstream-builder/asb-app.c
index 5494bb8..07be8be 100644
--- a/libappstream-builder/asb-app.c
+++ b/libappstream-builder/asb-app.c
@@ -423,6 +423,20 @@ asb_app_add_screenshot_source (AsbApp *app, const gchar *filename, GError **erro
filename_no_path);
}
+ /* check screenshot is reasonable in size */
+ if (as_image_get_width (im_src) * 2 < AS_IMAGE_NORMAL_WIDTH ||
+ as_image_get_height (im_src) * 2 < AS_IMAGE_NORMAL_HEIGHT) {
+ filename_no_path = g_path_get_basename (filename);
+ g_set_error (error,
+ AS_APP_ERROR,
+ AS_APP_ERROR_FAILED,
+ "%s is too small to be used: %ix%i",
+ filename_no_path,
+ as_image_get_width (im_src),
+ as_image_get_height (im_src));
+ return FALSE;
+ }
+
/* check the image is not padded */
alpha_flags = as_image_get_alpha_flags (im_src);
if ((alpha_flags & AS_IMAGE_ALPHA_FLAG_TOP) > 0||