aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-05-18 20:28:21 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-05-18 20:28:21 +0100
commitd46799f2874622e356fe263aa9fbda99156247f2 (patch)
tree0f4d982ec4de0cf123e593c336a248a0001080c1 /src/libmime
parent68a07a2c1d66746a9265ddcf539c494b96a5f63f (diff)
downloadrspamd-d46799f2874622e356fe263aa9fbda99156247f2.tar.gz
rspamd-d46799f2874622e356fe263aa9fbda99156247f2.zip
[Minor] Always report multipattern compile error
Issue: #4487
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/message.c9
-rw-r--r--src/libmime/mime_parser.c8
2 files changed, 15 insertions, 2 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index ad2cccf92..af8ad0e56 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -666,7 +666,14 @@ rspamd_check_gtube (struct rspamd_task *task, struct rspamd_mime_text_part *part
gtube_pattern_no_action,
RSPAMD_MULTIPATTERN_DEFAULT);
- g_assert (rspamd_multipattern_compile (gtube_matcher, NULL));
+ GError *err = NULL;
+ rspamd_multipattern_compile (gtube_matcher, &err);
+
+ if (err != NULL) {
+ /* It will be expensive, but I don't care, still better than to abort */
+ msg_err ("cannot compile gtube matcher: %s", err->message);
+ g_error_free (err);
+ }
}
if (part->utf_content.len >= sizeof (gtube_pattern_reject) &&
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index 538c05735..48b946d8f 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -167,7 +167,13 @@ rspamd_mime_parser_init_lib (void)
g_assert (lib_ctx->mp_boundary != NULL);
rspamd_multipattern_add_pattern (lib_ctx->mp_boundary, "\r--", 0);
rspamd_multipattern_add_pattern (lib_ctx->mp_boundary, "\n--", 0);
- g_assert (rspamd_multipattern_compile (lib_ctx->mp_boundary, NULL));
+
+ GError *err = NULL;
+ if (!rspamd_multipattern_compile (lib_ctx->mp_boundary, &err)) {
+ msg_err ("fatal error: cannot compile multipattern for mime parser boundaries: %e", err);
+ g_error_free (err);
+ g_abort();
+ }
ottery_rand_bytes (lib_ctx->hkey, sizeof (lib_ctx->hkey));
}