commit 03f7369: [Minor] Fix enum handling

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Dec 4 14:21:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-12-04 14:20:26 +0000
URL: https://github.com/rspamd/rspamd/commit/03f73692a9cdc4b42aede804faa44572545ebdfc (HEAD -> master)

[Minor] Fix enum handling

---
 src/libserver/html/html.cxx     | 2 +-
 src/libserver/html/html_tag.hxx | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index a920f9a4f..c782148d2 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -2017,7 +2017,7 @@ html_process_input(rspamd_mempool_t *pool,
 	/* Propagate styles */
 	hc->traverse_block_tags([&hc, &pool](const html_tag *tag) -> bool {
 
-		if (hc->css_style) {
+		if (hc->css_style && tag->id > Tag_UNKNOWN && tag->id < Tag_MAX) {
 			auto *css_block = hc->css_style->check_tag_block(tag);
 
 			if (css_block) {
diff --git a/src/libserver/html/html_tag.hxx b/src/libserver/html/html_tag.hxx
index 5971ca179..ba086be82 100644
--- a/src/libserver/html/html_tag.hxx
+++ b/src/libserver/html/html_tag.hxx
@@ -91,7 +91,7 @@ struct html_tag {
 	unsigned int tag_start = 0;
 	unsigned int content_offset = 0;
 	std::uint32_t flags = 0;
-	tag_id_t id = Tag_UNKNOWN;
+	std::int32_t id = Tag_UNKNOWN;
 	html_closing_tag closing;
 
 	std::vector<html_tag_component> components;


More information about the Commits mailing list