]> source.dussan.org Git - rspamd.git/commitdiff
Fix processing of some stupid expressions.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Mar 2015 22:53:17 +0000 (22:53 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Mar 2015 22:53:17 +0000 (22:53 +0000)
src/libutil/expression.c

index 5c057734c402717becd2d436bd7c54a1e49bcc41..41b30010b9c09f20905ae7f7961886ad89b6da94 100644 (file)
@@ -544,10 +544,17 @@ err:
        (e1) : (e2))
 #define CHOOSE_REMAIN(e1, e2, es) ((es) == (e1) ? (e2) : (e1))
 #define PROCESS_ELT(expr, e)   do {                                                                            \
+               g_assert ((e)->type != ELT_OP);                                                                         \
                if (!((e)->flags & RSPAMD_EXPR_FLAG_PROCESSED)) {                                       \
-                       (e)->value = (expr)->subr->process (data, (e)->p.atom);                 \
+                       if ((e)->type == ELT_ATOM) {                                                                    \
+                               (e)->value = (expr)->subr->process (data, (e)->p.atom);         \
+                       }                                                                                                                               \
+                       else {                                                                                                                  \
+                               (e)->value = (e)->p.lim.val;                                                            \
+                       }                                                                                                                               \
                        (e)->flags |= RSPAMD_EXPR_FLAG_PROCESSED;                                               \
                        if ((e)->flags & RSPAMD_EXPR_FLAG_NEGATE) {                                             \
+                               (e)->flags &= ~RSPAMD_EXPR_FLAG_NEGATE;                                         \
                                (e)->value = !(e)->value;                                                                       \
                        }                                                                                                                               \
                }                                                                                                                                       \