From 32c5b15326207015e52bc9df33582eea6caa0ba3 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 7 Mar 2019 17:12:41 +0100 Subject: [PATCH] icon-validator: Don't check SVG size The size is just a number, but the resulting GdkPixbuf could still be quite big compared to the amount of data we're processing, so keep 4096x4096 as maximum dimensions. Closes: #2747 Approved by: alexlarsson --- icon-validator/validate-icon.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/icon-validator/validate-icon.c b/icon-validator/validate-icon.c index 4e99b34d..af1c8208 100644 --- a/icon-validator/validate-icon.c +++ b/icon-validator/validate-icon.c @@ -49,18 +49,26 @@ validate_icon (const char *arg_width, return 1; } - max_width = g_ascii_strtoll (arg_width, NULL, 10); - if (max_width < 16 || max_width > 4096) + if (!g_str_equal (name, "svg")) { - g_printerr ("Bad width limit: %s\n", arg_width); - return 1; - } + max_width = g_ascii_strtoll (arg_width, NULL, 10); + if (max_width < 16 || max_width > 4096) + { + g_printerr ("Bad width limit: %s\n", arg_width); + return 1; + } - max_height = g_ascii_strtoll (arg_height, NULL, 10); - if (max_height < 16 || max_height > 4096) + max_height = g_ascii_strtoll (arg_height, NULL, 10); + if (max_height < 16 || max_height > 4096) + { + g_printerr ("Bad height limit: %s\n", arg_height); + return 1; + } + } + else { - g_printerr ("Bad height limit: %s\n", arg_height); - return 1; + /* Sanity check for vector files */ + max_height = max_width = 4096; } if (width > max_width || height > max_height)