commit 5aac0be: [Minor] Add safe-guard for the root tag
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Nov 19 10:56:05 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-11-19 10:49:54 +0000
URL: https://github.com/rspamd/rspamd/commit/5aac0be13a65b396fd1c62ff95fb8657cc109a32 (HEAD -> master)
[Minor] Add safe-guard for the root tag
---
src/libserver/html/html.cxx | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 5260ba690..a920f9a4f 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -1400,18 +1400,20 @@ html_process_input(rspamd_mempool_t *pool,
}
if (pt) {
+ g_assert(cur_tag != pt);
cur_tag->parent = pt;
- g_assert(cur_tag->parent != cur_tag);
g_assert(cur_tag->parent != &cur_closing_tag);
parent_tag = pt;
parent_tag->children.push_back(cur_tag);
}
else {
if (hc->root_tag) {
- cur_tag->parent = hc->root_tag;
- g_assert(cur_tag->parent != cur_tag);
- hc->root_tag->children.push_back(cur_tag);
- parent_tag = hc->root_tag;
+ if (cur_tag != hc->root_tag) {
+ cur_tag->parent = hc->root_tag;
+ g_assert(cur_tag->parent != cur_tag);
+ hc->root_tag->children.push_back(cur_tag);
+ parent_tag = hc->root_tag;
+ }
}
else {
if (cur_tag->id == Tag_HTML) {
More information about the Commits
mailing list