1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-23 17:33:50 +03:00

xmllint: Fix resetting error in xmlHTMLPrintError

Make sure that we don't change the error handler when fuzzing.
This commit is contained in:
Nick Wellnhofer 2024-06-16 17:36:05 +02:00
parent 481fd6bbee
commit c9b065914f

View File

@ -485,12 +485,16 @@ static void
xmlHTMLPrintError(void *ctx, const char *level, const char *msg, va_list ap) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserInputPtr input;
xmlGenericErrorFunc oldError;
void *oldErrorCtxt;
input = ctxt->input;
if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
input = ctxt->inputTab[ctxt->inputNr - 2];
}
oldError = xmlGenericError;
oldErrorCtxt = xmlGenericErrorContext;
xmlSetGenericErrorFunc(NULL, xmlHTMLBufCat);
fprintf(ERR_STREAM, "<p>");
@ -514,7 +518,7 @@ xmlHTMLPrintError(void *ctx, const char *level, const char *msg, va_list ap) {
fprintf(ERR_STREAM, "</pre>");
}
xmlSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc(oldErrorCtxt, oldError);
}
/**