Skip to content

Commit 323ddac

Browse files
authored
Merge pull request #502 from htacg/issue-498
Issue #498 - parser.c - if a <table> in a <table> just close. This fixes #498
2 parents 6574225 + a49890e commit 323ddac

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/parser.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,9 +3019,22 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
30193019

30203020
while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL)
30213021
{
3022-
if (node->tag == table->tag && node->type == EndTag)
3022+
if (node->tag == table->tag )
30233023
{
3024-
TY_(FreeNode)( doc, node);
3024+
if (node->type == EndTag)
3025+
{
3026+
TY_(FreeNode)(doc, node);
3027+
}
3028+
else
3029+
{
3030+
/* Issue #498 - If a <table> in a <table>
3031+
* just close the current table, and issue a
3032+
* warning. The previous action was to discard
3033+
* this second <table>
3034+
*/
3035+
TY_(UngetToken)(doc);
3036+
TY_(ReportError)(doc, table, node, TAG_NOT_ALLOWED_IN);
3037+
}
30253038
lexer->istackbase = istackbase;
30263039
table->closed = yes;
30273040
#if !defined(NDEBUG) && defined(_MSC_VER)

0 commit comments

Comments
 (0)