return img;
}
-#define SET_P(off_i, off_j) do { \
- p[0] = (guint)gdImageGetPixel (dst, i + (off_i), j + (off_j)); \
- p[1] = (guint)gdImageGetPixel (dst, i + (off_i), j + (off_j) + 1); \
- p[2] = (guint)gdImageGetPixel (dst, i + (off_i), j + (off_j) + 2); \
- p[3] = (guint)gdImageGetPixel (dst, i + (off_i), j + (off_j) + 3); \
- p[4] = (guint)gdImageGetPixel (dst, i + (off_i) + 1, j + (off_j)); \
- p[5] = (guint)gdImageGetPixel (dst, i + (off_i) + 1, j + (off_j) + 1); \
- p[6] = (guint)gdImageGetPixel (dst, i + (off_i) + 1, j + (off_j) + 2); \
- p[7] = (guint)gdImageGetPixel (dst, i + (off_i) + 1, j + (off_j) + 3); \
-} while (0)
-
-#define SET_N() do { \
- n += (guint) ((gint)p[0] - navg); \
- n += (guint) ((gint)p[1] - navg); \
- n += (guint) ((gint)p[2] - navg); \
- n += (guint) ((gint)p[3] - navg); \
- n += (guint) ((gint)p[4] - navg); \
- n += (guint) ((gint)p[5] - navg); \
- n += (guint) ((gint)p[6] - navg); \
- n += (guint) ((gint)p[7] - navg); \
-} while (0)
-
#ifdef WITH_GD
/*
* DCT from Emil Mikulic.
#endif
}
-#undef SET_P
-
static void
process_image (struct rspamd_task *task, struct rspamd_mime_part *part)
{
task->message_id);
img->filename = part->filename;
img->parent = part;
- rspamd_image_normalize (task, img);
+
+ if (img->data->len <= task->cfg->max_pic_size) {
+ rspamd_image_normalize (task, img);
+ }
+ else {
+ msg_info_task ("skip normalization for image %s: too large: %z",
+ img->filename, img->data->len);
+ }
part->flags |= RSPAMD_MIME_PART_IMAGE;
part->specific_data = img;
rspamd_rcl_parse_struct_integer,
G_STRUCT_OFFSET (struct rspamd_config, max_message),
RSPAMD_CL_FLAG_INT_SIZE,
- "Maximum size of the message to be scanned");
+ "Maximum size of the message to be scanned (50Mb by default)");
+ rspamd_rcl_add_default_handler (sub,
+ "max_pic",
+ rspamd_rcl_parse_struct_integer,
+ G_STRUCT_OFFSET (struct rspamd_config, max_pic_size),
+ RSPAMD_CL_FLAG_INT_SIZE,
+ "Maximum size of the picture to be normalized (1Mb by default)");
rspamd_rcl_add_default_handler (sub,
"zstd_input_dictionary",
rspamd_rcl_parse_struct_string,
#define DEFAULT_MAX_WORD 40
#define DEFAULT_WORDS_DECAY 200
#define DEFAULT_MAX_MESSAGE (50 * 1024 * 1024)
+#define DEFAULT_MAX_PIC (1 * 1024 * 1024)
struct rspamd_ucl_map_cbdata {
struct rspamd_config *cfg;
cfg->ssl_ciphers = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4";
cfg->max_message = DEFAULT_MAX_MESSAGE;
+ cfg->max_pic_size = DEFAULT_MAX_PIC;
cfg->monitored_ctx = rspamd_monitored_ctx_init ();
#ifdef WITH_HIREDIS
cfg->redis_pool = rspamd_redis_pool_init ();