]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix crash on redundant <style> tag
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 19 Jul 2021 15:47:42 +0000 (16:47 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 19 Jul 2021 15:47:42 +0000 (16:47 +0100)
src/libserver/html/html.cxx

index 9b3a8a3eebb381da0d571cb182179ee2de2fb6f6..c5dea793a5355a45bb16a5ad5cefe8a493cedeb2 100644 (file)
@@ -1772,7 +1772,8 @@ html_process_input(rspamd_mempool_t *pool,
                                if (cur_tag->id == Tag_STYLE && allow_css) {
                                        auto *opening_tag = cur_tag->parent;
 
-                                       if (opening_tag && opening_tag->content_offset < opening_tag->closing.start) {
+                                       if (opening_tag && opening_tag->id == Tag_STYLE &&
+                                               (int)opening_tag->content_offset < opening_tag->closing.start) {
                                                auto ret_maybe = rspamd::css::parse_css(pool,
                                                                {start + opening_tag->content_offset,
                                                                 opening_tag->closing.start - opening_tag->content_offset},