1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

parser: Report malloc failures

Fix many places where malloc failures aren't reported.

Make xmlErrMemory public. This is useful for custom external entity
loaders.

Introduce new API function xmlSwitchEncodingName.

Change the way how we store whether the the parser is stopped. This used
to be signaled by setting ctxt->instate to XML_PARSER_EOF which was
misdesigned and error-prone. Set ctxt->disableSAX to 2 instead and
introduce a macro PARSER_STOPPED. Also stop to remove parser inputs in
xmlHaltParser. This allows to remove many checks of ctxt->instate.

Introduce xmlErrParser to handle errors if a parser context is
available.
This commit is contained in:
Nick Wellnhofer
2023-12-10 17:50:22 +01:00
parent 0d97e43993
commit f19a95108a
8 changed files with 796 additions and 911 deletions

View File

@@ -207,12 +207,6 @@ int main(int argc, char **argv) {
#include <libxml/xpointer.h>
#include <libxml/debugXML.h>
/*
We manually define xmlErrMemory because it's normal declaration
is "hidden" by #ifdef IN_LIBXML
*/
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
/*
We need some "remote" addresses, but want to avoid getting into
name resolution delays, so we use these