diff options
author | Bastien Nocera <hadess@hadess.net> | 2019-03-07 17:11:00 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-03-12 13:07:41 +0000 |
commit | 8008fe38a19122ca4352a31c3846da37fa270b8b (patch) | |
tree | 0e057fd85d6c158b1908369291885f9be93b8f36 /icon-validator | |
parent | f3e3147d781b6e7e9d4bbffd86ddcb832a880d10 (diff) | |
download | flatpak-8008fe38a19122ca4352a31c3846da37fa270b8b.tar.gz |
icon-validator: Check image format first
Closes: #2747
Approved by: alexlarsson
Diffstat (limited to 'icon-validator')
-rw-r--r-- | icon-validator/validate-icon.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/icon-validator/validate-icon.c b/icon-validator/validate-icon.c index afd248bc..4e99b34d 100644 --- a/icon-validator/validate-icon.c +++ b/icon-validator/validate-icon.c @@ -35,31 +35,31 @@ validate_icon (const char *arg_width, g_autoptr(GdkPixbuf) pixbuf = NULL; g_autoptr(GError) error = NULL; - max_width = g_ascii_strtoll (arg_width, NULL, 10); - if (max_width < 16 || max_width > 4096) + format = gdk_pixbuf_get_file_info (filename, &width, &height); + if (format == NULL) { - g_printerr ("Bad width limit: %s\n", arg_width); + g_printerr ("Format not recognized\n"); return 1; } - max_height = g_ascii_strtoll (arg_height, NULL, 10); - if (max_height < 16 || max_height > 4096) + name = gdk_pixbuf_format_get_name (format); + if (!g_strv_contains (allowed_formats, name)) { - g_printerr ("Bad height limit: %s\n", arg_height); + g_printerr ("Format %s not accepted\n", name); return 1; } - format = gdk_pixbuf_get_file_info (filename, &width, &height); - if (format == NULL) + max_width = g_ascii_strtoll (arg_width, NULL, 10); + if (max_width < 16 || max_width > 4096) { - g_printerr ("Format not recognized\n"); + g_printerr ("Bad width limit: %s\n", arg_width); return 1; } - name = gdk_pixbuf_format_get_name (format); - if (!g_strv_contains (allowed_formats, name)) + max_height = g_ascii_strtoll (arg_height, NULL, 10); + if (max_height < 16 || max_height > 4096) { - g_printerr ("Format %s not accepted\n", name); + g_printerr ("Bad height limit: %s\n", arg_height); return 1; } |