diff --git a/src/validate-icon.c b/src/validate-icon.c index 4c73fc7d3..862f864f7 100644 --- a/src/validate-icon.c +++ b/src/validate-icon.c @@ -39,6 +39,7 @@ #define MAX_ICON_SIZE 512 #define MAX_SVG_ICON_SIZE 4096 #define BUFFER_SIZE 4096 +#define MAX_FILE_SIZE 4194304 /* Max file size of 4MB */ static int validate_icon (int input_fd) @@ -72,6 +73,12 @@ validate_icon (int input_fd) return 1; } + if (g_bytes_get_size (bytes) > MAX_FILE_SIZE) + { + g_printerr ("Image is bigger then the allowed size\n"); + return 1; + } + loader = gdk_pixbuf_loader_new (); if (!gdk_pixbuf_loader_write_bytes (loader, bytes, &error) ||