commit 24214a2: [Minor] Fix crash on redundant <style> tag

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 19 15:49:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-19 16:47:42 +0100
URL: https://github.com/rspamd/rspamd/commit/24214a2fa4485f08476d69c3b48619dd4ac309ac (HEAD -> master)

[Minor] Fix crash on redundant <style> tag

---
 src/libserver/html/html.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 9b3a8a3ee..c5dea793a 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -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},


More information about the Commits mailing list