summaryrefslogtreecommitdiff
path: root/HTMLparser.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2022-12-27 14:15:51 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2022-12-27 14:41:19 +0100
commit59b33661784359c6d3a8309ddbd2129fb2688548 (patch)
tree5f5b6aa11a7652250618bb1e04639f7900c181ed /HTMLparser.c
parentba910d344f33596cde7df2beb9600f01980616a0 (diff)
downloadlibxml2-59b33661784359c6d3a8309ddbd2129fb2688548.tar.gz
error: Limit number of parser errors
Reporting errors is expensive and some abusive test cases can generate an error for each invalid input byte. This causes the parser to spend most of the time with error handling. Limit the number of errors and warnings to 100.
Diffstat (limited to 'HTMLparser.c')
-rw-r--r--HTMLparser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/HTMLparser.c b/HTMLparser.c
index b716f63c..a53f7083 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -6790,6 +6790,11 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
xmlHashFree(ctxt->attsSpecial, NULL);
ctxt->attsSpecial = NULL;
}
+
+ ctxt->nbErrors = 0;
+ ctxt->nbWarnings = 0;
+ if (ctxt->lastError.code != XML_ERR_OK)
+ xmlResetError(&ctxt->lastError);
}
/**