[LIBXML2] Update to version 2.9.10. CORE-16952

This commit is contained in:
Thomas Faber 2020-04-22 23:32:51 +02:00
parent b82bf8ce16
commit f22fa382fe
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
65 changed files with 2245 additions and 2056 deletions

View file

@ -40,7 +40,7 @@ Used Version: 1.0 REV 5
Website: http://www.gnu.org/software/adns/ | http://adns.jgaa.com Website: http://www.gnu.org/software/adns/ | http://adns.jgaa.com
Title: LibXML Title: LibXML
Used Version: 2.9.9 Used Version: 2.9.10
Website: http://xmlsoft.org | ftp://xmlsoft.org/libxml2/ Website: http://xmlsoft.org | ftp://xmlsoft.org/libxml2/
Title: Libxslt Title: Libxslt
@ -84,7 +84,7 @@ Used Version: 4.1.0
Website: http://www.simplesystems.org/libtiff/ Website: http://www.simplesystems.org/libtiff/
Title: mbed TLS Title: mbed TLS
Used Version: 2.7.14 Used Version: 2.7.15
Website: https://tls.mbed.org/ Website: https://tls.mbed.org/
Title: libpng Title: libpng

View file

@ -28,17 +28,17 @@ extern "C" {
#include <libxml/xpath.h> #include <libxml/xpath.h>
/* /*
* XML Canonicazation * XML Canonicalization
* http://www.w3.org/TR/xml-c14n * http://www.w3.org/TR/xml-c14n
* *
* Exclusive XML Canonicazation * Exclusive XML Canonicalization
* http://www.w3.org/TR/xml-exc-c14n * http://www.w3.org/TR/xml-exc-c14n
* *
* Canonical form of an XML document could be created if and only if * Canonical form of an XML document could be created if and only if
* a) default attributes (if any) are added to all nodes * a) default attributes (if any) are added to all nodes
* b) all character and parsed entity references are resolved * b) all character and parsed entity references are resolved
* In order to achive this in libxml2 the document MUST be loaded with * In order to achieve this in libxml2 the document MUST be loaded with
* following global setings: * following global settings:
* *
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* xmlSubstituteEntitiesDefault(1); * xmlSubstituteEntitiesDefault(1);
@ -59,7 +59,7 @@ extern "C" {
* *
*/ */
typedef enum { typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ XML_C14N_1_0 = 0, /* Original C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */ XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode; } xmlC14NMode;
@ -96,7 +96,7 @@ XMLPUBFUN int XMLCALL
/** /**
* xmlC14NIsVisibleCallback: * xmlC14NIsVisibleCallback:
* @user_data: user data * @user_data: user data
* @node: the curent node * @node: the current node
* @parent: the parent node * @parent: the parent node
* *
* Signature for a C14N callback on visible nodes * Signature for a C14N callback on visible nodes

View file

@ -39,7 +39,7 @@ extern "C" {
/** /**
* XML_CATALOG_PI: * XML_CATALOG_PI:
* *
* The specific XML Catalog Processing Instuction name. * The specific XML Catalog Processing Instruction name.
*/ */
#define XML_CATALOG_PI \ #define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog" (const xmlChar *) "oasis-xml-catalog"

View file

@ -11,25 +11,18 @@
#ifndef __XML_DICT_H__ #ifndef __XML_DICT_H__
#define __XML_DICT_H__ #define __XML_DICT_H__
#include <stddef.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus #ifdef __cplusplus
#define __XML_EXTERNC extern "C" extern "C" {
#else
#define __XML_EXTERNC
#endif #endif
/* /*
* The dictionary. * The dictionary.
*/ */
__XML_EXTERNC typedef struct _xmlDict xmlDict; typedef struct _xmlDict xmlDict;
__XML_EXTERNC typedef xmlDict *xmlDictPtr; typedef xmlDict *xmlDictPtr;
#include <limits.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/* /*
* Initializer * Initializer

View file

@ -80,7 +80,7 @@ typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
/** /**
* xmlHashScanner: * xmlHashScanner:
* @payload: the data in the hash * @payload: the data in the hash
* @data: extra scannner data * @data: extra scanner data
* @name: the name associated * @name: the name associated
* *
* Callback when scanning data in a hash with the simple scanner. * Callback when scanning data in a hash with the simple scanner.
@ -89,7 +89,7 @@ typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
/** /**
* xmlHashScannerFull: * xmlHashScannerFull:
* @payload: the data in the hash * @payload: the data in the hash
* @data: extra scannner data * @data: extra scanner data
* @name: the name associated * @name: the name associated
* @name2: the second name associated * @name2: the second name associated
* @name3: the third name associated * @name3: the third name associated

View file

@ -283,11 +283,11 @@ struct _xmlParserCtxt {
void * *pushTab; /* array of data for push */ void * *pushTab; /* array of data for push */
xmlHashTablePtr attsDefault; /* defaulted attributes if any */ xmlHashTablePtr attsDefault; /* defaulted attributes if any */
xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
int nsWellFormed; /* is the document XML Nanespace okay */ int nsWellFormed; /* is the document XML Namespace okay */
int options; /* Extra options */ int options; /* Extra options */
/* /*
* Those fields are needed only for treaming parsing so far * Those fields are needed only for streaming parsing so far
*/ */
int dictNames; /* Use dictionary names for the tree */ int dictNames; /* Use dictionary names for the tree */
int freeElemsNr; /* number of freed element nodes */ int freeElemsNr; /* number of freed element nodes */
@ -1097,7 +1097,7 @@ typedef enum {
XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */
XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitution */
XML_PARSE_NONET = 1<<11,/* Forbid network access */ XML_PARSE_NONET = 1<<11,/* Forbid network access */
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */ XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
@ -1191,7 +1191,7 @@ XMLPUBFUN xmlDocPtr XMLCALL
/** /**
* xmlFeature: * xmlFeature:
* *
* Used to examine the existance of features that can be enabled * Used to examine the existence of features that can be enabled
* or disabled at compile-time. * or disabled at compile-time.
* They used to be called XML_FEATURE_xxx but this clashed with Expat * They used to be called XML_FEATURE_xxx but this clashed with Expat
*/ */

View file

@ -43,7 +43,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
/** /**
* XML_MAX_NAME_LENGTH: * XML_MAX_NAME_LENGTH:
* *
* Maximum size allowed for a markup identitier * Maximum size allowed for a markup identifier.
* This is not a limitation of the parser but a safety boundary feature, * This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it. * use XML_PARSE_HUGE option to override it.
* Note that with the use of parsing dictionaries overriding the limit * Note that with the use of parsing dictionaries overriding the limit

View file

@ -321,13 +321,13 @@ struct _xmlSchemaWildcard {
/** /**
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
* *
* The attribute wildcard has been already builded. * The attribute wildcard has been built.
*/ */
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
/** /**
* XML_SCHEMAS_ATTRGROUP_GLOBAL: * XML_SCHEMAS_ATTRGROUP_GLOBAL:
* *
* The attribute wildcard has been already builded. * The attribute group has been defined.
*/ */
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 #define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
/** /**
@ -725,7 +725,7 @@ struct _xmlSchemaType {
/** /**
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
* *
* disallowed substitutions: "substituion" * disallowed substitutions: "substitution"
*/ */
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
/** /**
@ -789,7 +789,7 @@ struct _xmlSchemaElement {
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
xmlSchemaContentType contentType; xmlSchemaContentType contentType;
const xmlChar *refPrefix; /* Deprecated; not used */ const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value contraint. */ xmlSchemaValPtr defVal; /* The compiled value constraint. */
void *idcs; /* The identity-constraint defs */ void *idcs; /* The identity-constraint defs */
}; };
@ -881,7 +881,7 @@ struct _xmlSchemaNotation {
/** /**
* XML_SCHEMAS_FINAL_DEFAULT_LIST: * XML_SCHEMAS_FINAL_DEFAULT_LIST:
* *
* the cshema has "list" in the set of finalDefault. * the schema has "list" in the set of finalDefault.
*/ */
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 #define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
/** /**
@ -942,7 +942,7 @@ struct _xmlSchema {
xmlDictPtr dict; xmlDictPtr dict;
void *includes; /* the includes, this is opaque for now */ void *includes; /* the includes, this is opaque for now */
int preserve; /* whether to free the document */ int preserve; /* whether to free the document */
int counter; /* used to give ononymous components unique names */ int counter; /* used to give anonymous components unique names */
xmlHashTablePtr idcDef; /* All identity-constraint defs. */ xmlHashTablePtr idcDef; /* All identity-constraint defs. */
void *volatiles; /* Obsolete */ void *volatiles; /* Obsolete */
}; };

View file

@ -527,7 +527,7 @@ struct _xmlNode {
* xmlDocProperty * xmlDocProperty
* *
* Set of properties of the document as found by the parser * Set of properties of the document as found by the parser
* Some of them are linked to similary named xmlParserOption * Some of them are linked to similarly named xmlParserOption
*/ */
typedef enum { typedef enum {
XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */

View file

@ -26,7 +26,7 @@ extern "C" {
* of namespaces. If "foo" is the prefix for "http://foo.com/" * of namespaces. If "foo" is the prefix for "http://foo.com/"
* then the link detection layer will expand role="foo:myrole" * then the link detection layer will expand role="foo:myrole"
* to "http://foo.com/:myrole". * to "http://foo.com/:myrole".
* NOTE: the link detection layer will expand URI-Refences found on * NOTE: the link detection layer will expand URI-References found on
* href attributes by using the base mechanism if found. * href attributes by using the base mechanism if found.
*/ */
typedef xmlChar *xlinkHRef; typedef xmlChar *xlinkHRef;

View file

@ -27,7 +27,7 @@ extern "C" {
* @filename: the filename or URI * @filename: the filename or URI
* *
* Callback used in the I/O Input API to detect if the current handler * Callback used in the I/O Input API to detect if the current handler
* can provide input fonctionnalities for this resource. * can provide input functionality for this resource.
* *
* Returns 1 if yes and 0 if another Input module should be used * Returns 1 if yes and 0 if another Input module should be used
*/ */
@ -73,7 +73,7 @@ typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
* @filename: the filename or URI * @filename: the filename or URI
* *
* Callback used in the I/O Output API to detect if the current handler * Callback used in the I/O Output API to detect if the current handler
* can provide output fonctionnalities for this resource. * can provide output functionality for this resource.
* *
* Returns 1 if yes and 0 if another Output module should be used * Returns 1 if yes and 0 if another Output module should be used
*/ */

View file

@ -837,7 +837,7 @@ typedef enum {
* xmlGenericErrorFunc: * xmlGenericErrorFunc:
* @ctx: a parsing context * @ctx: a parsing context
* @msg: the message * @msg: the message
* @...: the extra arguments of the varags to format the message * @...: the extra arguments of the varargs to format the message
* *
* Signature of the function to use when there is an error and * Signature of the function to use when there is an error and
* no parsing or validity context available . * no parsing or validity context available .

View file

@ -73,9 +73,6 @@
#define XMLCALL __cdecl #define XMLCALL __cdecl
#endif #endif
#define XMLCDECL __cdecl #define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif #endif
/* Windows platform with Borland compiler */ /* Windows platform with Borland compiler */
@ -97,9 +94,6 @@
#endif #endif
#define XMLCALL __cdecl #define XMLCALL __cdecl
#define XMLCDECL __cdecl #define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif #endif
/* Windows platform with GNU compiler (Mingw) */ /* Windows platform with GNU compiler (Mingw) */
@ -126,9 +120,6 @@
#endif #endif
#define XMLCALL __cdecl #define XMLCALL __cdecl
#define XMLCDECL __cdecl #define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif #endif
/* Cygwin platform (does not define _WIN32), GNU compiler */ /* Cygwin platform (does not define _WIN32), GNU compiler */

View file

@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* *
* the version string like "1.2.3" * the version string like "1.2.3"
*/ */
#define LIBXML_DOTTED_VERSION "2.9.9" #define LIBXML_DOTTED_VERSION "2.9.10"
/** /**
* LIBXML_VERSION: * LIBXML_VERSION:
* *
* the version number: 1.2.3 value is 10203 * the version number: 1.2.3 value is 10203
*/ */
#define LIBXML_VERSION 20909 #define LIBXML_VERSION 20910
/** /**
* LIBXML_VERSION_STRING: * LIBXML_VERSION_STRING:
* *
* the version number string, 1.2.3 value is "10203" * the version number string, 1.2.3 value is "10203"
*/ */
#define LIBXML_VERSION_STRING "20909" #define LIBXML_VERSION_STRING "20910"
/** /**
* LIBXML_VERSION_EXTRA: * LIBXML_VERSION_EXTRA:
* *
* extra version information, used to show a CVS compilation * extra version information, used to show a CVS compilation
*/ */
#define LIBXML_VERSION_EXTRA "-GITv2.9.9-rc2-2-g7c4949afa" #define LIBXML_VERSION_EXTRA "-GITv2.9.10-rc1-2-ga5bb6aaa2"
/** /**
* LIBXML_TEST_VERSION: * LIBXML_TEST_VERSION:
@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with * Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against * the version the software has been compiled against
*/ */
#define LIBXML_TEST_VERSION xmlCheckVersion(20909); #define LIBXML_TEST_VERSION xmlCheckVersion(20910);
#ifndef VMS #ifndef VMS
#if 0 #if 0
@ -91,11 +91,8 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Whether the thread support is configured in * Whether the thread support is configured in
*/ */
#if 1 #if 1
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED #define LIBXML_THREAD_ENABLED
#endif #endif
#endif
/** /**
* LIBXML_THREAD_ALLOC_ENABLED: * LIBXML_THREAD_ALLOC_ENABLED:
@ -291,7 +288,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* *
* Whether ISO-8859-* support is made available in case iconv is not * Whether ISO-8859-* support is made available in case iconv is not
*/ */
#if 0 #if 1
#define LIBXML_ISO8859X_ENABLED #define LIBXML_ISO8859X_ENABLED
#endif #endif
@ -353,8 +350,10 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* LIBXML_EXPR_ENABLED: * LIBXML_EXPR_ENABLED:
* *
* Whether the formal expressions interfaces are compiled in * Whether the formal expressions interfaces are compiled in
*
* This code is unused and disabled unconditionally for now.
*/ */
#if 1 #if 0
#define LIBXML_EXPR_ENABLED #define LIBXML_EXPR_ENABLED
#endif #endif

View file

@ -91,11 +91,8 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Whether the thread support is configured in * Whether the thread support is configured in
*/ */
#if @WITH_THREADS@ #if @WITH_THREADS@
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED #define LIBXML_THREAD_ENABLED
#endif #endif
#endif
/** /**
* LIBXML_THREAD_ALLOC_ENABLED: * LIBXML_THREAD_ALLOC_ENABLED:
@ -353,8 +350,10 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* LIBXML_EXPR_ENABLED: * LIBXML_EXPR_ENABLED:
* *
* Whether the formal expressions interfaces are compiled in * Whether the formal expressions interfaces are compiled in
*
* This code is unused and disabled unconditionally for now.
*/ */
#if @WITH_SCHEMAS@ #if 0
#define LIBXML_EXPR_ENABLED #define LIBXML_EXPR_ENABLED
#endif #endif

View file

@ -70,7 +70,9 @@ typedef enum {
XPATH_INVALID_CHAR_ERROR, XPATH_INVALID_CHAR_ERROR,
XPATH_INVALID_CTXT, XPATH_INVALID_CTXT,
XPATH_STACK_ERROR, XPATH_STACK_ERROR,
XPATH_FORBID_VARIABLE_ERROR XPATH_FORBID_VARIABLE_ERROR,
XPATH_OP_LIMIT_EXCEEDED,
XPATH_RECURSION_LIMIT_EXCEEDED
} xmlXPathError; } xmlXPathError;
/* /*
@ -82,7 +84,7 @@ struct _xmlNodeSet {
int nodeNr; /* number of nodes in the set */ int nodeNr; /* number of nodes in the set */
int nodeMax; /* size of the array as allocated */ int nodeMax; /* size of the array as allocated */
xmlNodePtr *nodeTab; /* array of nodes in no particular order */ xmlNodePtr *nodeTab; /* array of nodes in no particular order */
/* @@ with_ns to check wether namespace nodes should be looked at @@ */ /* @@ with_ns to check whether namespace nodes should be looked at @@ */
}; };
/* /*
@ -352,6 +354,13 @@ struct _xmlXPathContext {
/* Cache for reusal of XPath objects */ /* Cache for reusal of XPath objects */
void *cache; void *cache;
/* Resource limits */
unsigned long opLimit;
unsigned long opCount;
int depth;
int maxDepth;
int maxParserDepth;
}; };
/* /*

View file

@ -463,7 +463,7 @@ Thu Jul 31 21:49:45 CEST 2008 Daniel Veillard <daniel@veillard.com>
allow to make Name and NmToken validations based on the parser allow to make Name and NmToken validations based on the parser
flags, more specifically the 5th edition of XML or not flags, more specifically the 5th edition of XML or not
* HTMLparser.c tree.c: small side effects for the previous changes * HTMLparser.c tree.c: small side effects for the previous changes
* parser.c SAX2.c valid.c: the bulk of teh changes are here, * parser.c SAX2.c valid.c: the bulk of the changes are here,
the parser and validation behaviour can be affected, parsing the parser and validation behaviour can be affected, parsing
flags need to be copied, lot of changes. Also fixing various flags need to be copied, lot of changes. Also fixing various
validation problems in the regression tests. validation problems in the regression tests.
@ -1328,7 +1328,7 @@ Wed Mar 21 14:23:08 HKT 2007 William Brack <wbrack@mmm.com.hk>
Tue Mar 20 09:58:13 CET 2007 Daniel Veillard <daniel@veillard.com> Tue Mar 20 09:58:13 CET 2007 Daniel Veillard <daniel@veillard.com>
* nanoftp.c: applied patch from Björn Wiberg to try to fix again * nanoftp.c: applied patch from Björn Wiberg to try to fix again
the silly __ss_familly problem on various AIXes, should fix #420184 the silly __ss_family problem on various AIXes, should fix #420184
Wed Mar 14 20:30:38 HKT 2007 William Brack <wbrack@mmm.com.hk> Wed Mar 14 20:30:38 HKT 2007 William Brack <wbrack@mmm.com.hk>
@ -1519,7 +1519,7 @@ Tue Oct 17 22:19:02 CEST 2006 Daniel Veillard <daniel@veillard.com>
Tue Oct 17 22:04:31 CEST 2006 Daniel Veillard <daniel@veillard.com> Tue Oct 17 22:04:31 CEST 2006 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: fixed teh 2 stupid bugs affecting htmlReadDoc() and * HTMLparser.c: fixed the 2 stupid bugs affecting htmlReadDoc() and
htmlReadIO() this should fix #340322 htmlReadIO() this should fix #340322
Tue Oct 17 21:39:23 CEST 2006 Daniel Veillard <daniel@veillard.com> Tue Oct 17 21:39:23 CEST 2006 Daniel Veillard <daniel@veillard.com>
@ -1680,7 +1680,7 @@ Tue Oct 10 10:52:01 CEST 2006 Daniel Veillard <daniel@veillard.com>
Tue Oct 10 10:33:43 CEST 2006 Daniel Veillard <daniel@veillard.com> Tue Oct 10 10:33:43 CEST 2006 Daniel Veillard <daniel@veillard.com>
* python/libxml.py python/types.c: applied patch from Ross Reedstrom, * python/libxml.py python/types.c: applied patch from Ross Reedstrom,
Brian West and Stefan Anca to add XPointer suport to the Python bindings Brian West and Stefan Anca to add XPointer support to the Python bindings
Fri Sep 29 11:13:59 CEST 2006 Daniel Veillard <daniel@veillard.com> Fri Sep 29 11:13:59 CEST 2006 Daniel Veillard <daniel@veillard.com>
@ -2022,7 +2022,7 @@ Tue May 30 11:21:34 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xpath.c: Enhanced xmlXPathNodeCollectAndTest() to avoid * xpath.c: Enhanced xmlXPathNodeCollectAndTest() to avoid
recreation (if possible) of the node-set which is used to recreation (if possible) of the node-set which is used to
collect the nodes in the current axis for the currect context collect the nodes in the current axis for the current context
node. Especially for "//foo" this will decrease dramatically node. Especially for "//foo" this will decrease dramatically
the number of created node-sets, since for each node in the the number of created node-sets, since for each node in the
result node-set of the evaluation of descendant-or-self::node() result node-set of the evaluation of descendant-or-self::node()
@ -2056,7 +2056,7 @@ Wed May 24 10:54:25 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
xmlXPathNodeSetDupNs(); thus a pure memcpy is not possible. xmlXPathNodeSetDupNs(); thus a pure memcpy is not possible.
A flag on the node-set indicating if namespace nodes are in A flag on the node-set indicating if namespace nodes are in
the set would help here; this is the 3rd flag which would the set would help here; this is the 3rd flag which would
be usefull with node-sets. The current flags I have in mind: be useful with node-sets. The current flags I have in mind:
1) Is a node-set already sorted? 1) Is a node-set already sorted?
This would allow for rebust and optimizable sorting This would allow for rebust and optimizable sorting
behaviour. behaviour.
@ -2112,7 +2112,7 @@ Tue May 16 16:55:13 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
compilation time (unlike normal XPath, where we can bind compilation time (unlike normal XPath, where we can bind
namespace names to prefixes at execution time). namespace names to prefixes at execution time).
* pattern.c: Enhanced to use a string dict for local-names, * pattern.c: Enhanced to use a string dict for local-names,
ns-prefixes and and namespace-names. ns-prefixes and namespace-names.
Fixed xmlStreamPushInternal() not to use string-pointer Fixed xmlStreamPushInternal() not to use string-pointer
comparison if a dict is available; this won't work, since comparison if a dict is available; this won't work, since
one does not know it the given strings originate from the one does not know it the given strings originate from the
@ -2269,7 +2269,7 @@ Wed Mar 22 00:14:34 CET 2006 Daniel Veillard <daniel@veillard.com>
Fri Mar 10 08:40:55 EST 2006 Daniel Veillard <daniel@veillard.com> Fri Mar 10 08:40:55 EST 2006 Daniel Veillard <daniel@veillard.com>
* c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few * c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few
warning raised by gcc-4.1 and latests changes warning raised by gcc-4.1 and latest changes
Fri Mar 10 01:34:42 CET 2006 Daniel Veillard <daniel@veillard.com> Fri Mar 10 01:34:42 CET 2006 Daniel Veillard <daniel@veillard.com>
@ -2967,12 +2967,12 @@ Mon Oct 10 15:12:43 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
Fixed default/fixed values for attributes (looks like they Fixed default/fixed values for attributes (looks like they
did not work in the last releases). did not work in the last releases).
Completed constraints for attribute uses. Completed constraints for attribute uses.
Seperated attribute derivation from attribute constraints. Separated attribute derivation from attribute constraints.
Completed constraints for attribute group definitions. Completed constraints for attribute group definitions.
Disallowing <import>s of schemas in no target namespace if the Disallowing <import>s of schemas in no target namespace if the
importing schema is a chameleon schema. This contradicts importing schema is a chameleon schema. This contradicts
the way Saxon, Xerces-J, XSV and IBM's SQC works, but the the way Saxon, Xerces-J, XSV and IBM's SQC works, but the
W3C XML Schema WG, thinks it is correct to dissalow such W3C XML Schema WG, thinks it is correct to disallow such
imports. imports.
Added cos-all-limited constraints. Added cos-all-limited constraints.
Restructured reference resolution to model groups and element Restructured reference resolution to model groups and element
@ -4980,7 +4980,7 @@ Thu Jan 27 13:39:04 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
modules. modules.
Added machanism to store element information for the Added machanism to store element information for the
ancestor-or-self axis; this is needed for identity-constraints ancestor-or-self axis; this is needed for identity-constraints
and should be helpfull for a future streamable validation. and should be helpful for a future streamable validation.
* include/libxml/xmlerror.h: Added an error code for * include/libxml/xmlerror.h: Added an error code for
identity-constraints. identity-constraints.
@ -5639,7 +5639,7 @@ Tue Nov 2 15:49:34 CET 2004 Daniel Veillard <daniel@veillard.com>
automatic API regression test tool. automatic API regression test tool.
* SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c * SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c
xmlstring.c: various API hardeing changes as a result of running xmlstring.c: various API hardeing changes as a result of running
teh first set of automatic API regression tests. the first set of automatic API regression tests.
* test/slashdot16.xml: apparently missing from CVS, commited it * test/slashdot16.xml: apparently missing from CVS, commited it
Mon Nov 1 15:54:18 CET 2004 Daniel Veillard <daniel@veillard.com> Mon Nov 1 15:54:18 CET 2004 Daniel Veillard <daniel@veillard.com>
@ -5729,7 +5729,7 @@ Fri Oct 22 15:20:23 CEST 2004 Daniel Veillard <daniel@veillard.com>
Fri Oct 22 21:04:20 CEST 2004 Daniel Veillard <daniel@veillard.com> Fri Oct 22 21:04:20 CEST 2004 Daniel Veillard <daniel@veillard.com>
* python/libxml.c: fixed a problem occuring only in x86_64 when * python/libxml.c: fixed a problem occurring only in x86_64 when
very large error messages are raised to the Python handlers. very large error messages are raised to the Python handlers.
Thu Oct 21 18:03:21 CEST 2004 Daniel Veillard <daniel@veillard.com> Thu Oct 21 18:03:21 CEST 2004 Daniel Veillard <daniel@veillard.com>
@ -5908,7 +5908,7 @@ Fri Sep 24 16:14:12 CEST 2004 Daniel Veillard <daniel@veillard.com>
Thu Sep 23 18:23:46 CEST 2004 Daniel Veillard <daniel@veillard.com> Thu Sep 23 18:23:46 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmlschemastypes.c: fixing an out of bound adressing issue * xmlschemastypes.c: fixing an out of bound addressing issue
Thu Sep 23 15:14:12 CEST 2004 Daniel Veillard <daniel@veillard.com> Thu Sep 23 15:14:12 CEST 2004 Daniel Veillard <daniel@veillard.com>
@ -6069,7 +6069,7 @@ Fri Sep 3 20:29:59 CEST 2004 Kasimier Buchcik <libxml2-cvs@cazic.net>
of the wildcard. of the wildcard.
Added a check for circular attribute group references. Added a check for circular attribute group references.
Added a check for circular model group definition references. Added a check for circular model group definition references.
Fixed a dublicate xmlParserErrors enum value - see bug #151738. Fixed a duplicate xmlParserErrors enum value - see bug #151738.
Fri Sep 3 10:08:13 PDT 2004 William Brack <wbrack@mmmm.com.hk> Fri Sep 3 10:08:13 PDT 2004 William Brack <wbrack@mmmm.com.hk>
@ -6275,7 +6275,7 @@ Mon Aug 16 02:42:30 CEST 2004 Daniel Veillard <daniel@veillard.com>
include/libxml/xmlerror.h: cleanup to avoid 'error' identifier include/libxml/xmlerror.h: cleanup to avoid 'error' identifier
in includes #137414 in includes #137414
* parser.c SAX2.c debugXML.c include/libxml/parser.h: * parser.c SAX2.c debugXML.c include/libxml/parser.h:
first version of the inplementation of parsing within first version of the implementation of parsing within
the context of a node in the tree #142359, new function the context of a node in the tree #142359, new function
xmlParseInNodeContext(), added support at the xmllint --shell xmlParseInNodeContext(), added support at the xmllint --shell
level as the "set" function level as the "set" function
@ -6938,7 +6938,7 @@ Sun May 9 20:40:59 CEST 2004 Daniel Veillard <daniel@veillard.com>
Sun May 9 19:46:13 CEST 2004 Daniel Veillard <daniel@veillard.com> Sun May 9 19:46:13 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmlsave.c: apply fix for XHTML1 formating from Nick Wellnhofer * xmlsave.c: apply fix for XHTML1 formatting from Nick Wellnhofer
fixes bug #141266 fixes bug #141266
* test/xhtmlcomp result//xhtmlcomp*: added the specific regression * test/xhtmlcomp result//xhtmlcomp*: added the specific regression
test test
@ -7753,7 +7753,7 @@ Fri Jan 23 14:03:21 CET 2004 Daniel Veillard <daniel@veillard.com>
This is needed for XSLT to keep the stylesheet dictionary read-only This is needed for XSLT to keep the stylesheet dictionary read-only
while being able to reuse the strings for the transformation while being able to reuse the strings for the transformation
dictionary. dictionary.
* xinclude.c: fixed a dictionary reference counting problem occuring * xinclude.c: fixed a dictionary reference counting problem occurring
when document parsing failed. when document parsing failed.
* testSAX.c: adding option --repeat for timing 100times the parsing * testSAX.c: adding option --repeat for timing 100times the parsing
* doc/* : rebuilt all the docs * doc/* : rebuilt all the docs
@ -8947,7 +8947,7 @@ Sun Oct 19 00:15:38 HKT 2003 William Brack <wbrack@mmm.com.hk>
* include/libxml/parserInternals.h HTMLparser.c HTMLtree.c * include/libxml/parserInternals.h HTMLparser.c HTMLtree.c
SAX2.c catalog.c debugXML.c entities.c parser.c relaxng.c SAX2.c catalog.c debugXML.c entities.c parser.c relaxng.c
testSAX.c tree.c valid.c xmlschemas.c xmlschemastypes.c testSAX.c tree.c valid.c xmlschemas.c xmlschemastypes.c
xpath.c: Changed all (?) occurences where validation macros xpath.c: Changed all (?) occurrences where validation macros
(IS_xxx) had single-byte arguments to use IS_xxx_CH instead (IS_xxx) had single-byte arguments to use IS_xxx_CH instead
(e.g. IS_BLANK changed to IS_BLANK_CH). This gets rid of (e.g. IS_BLANK changed to IS_BLANK_CH). This gets rid of
many warning messages on certain platforms, and also high- many warning messages on certain platforms, and also high-
@ -8972,7 +8972,7 @@ Sat Oct 18 11:04:32 CEST 2003 Daniel Veillard <daniel@veillard.com>
a new source, like the xmlReadxx and xmlCtxtReadxxx a new source, like the xmlReadxx and xmlCtxtReadxxx
* win32/libxml2.def.src doc/libxml2-api.xml doc/apibuild.py * win32/libxml2.def.src doc/libxml2-api.xml doc/apibuild.py
doc/Makefile.am: regenerated the APIs doc/Makefile.am: regenerated the APIs
* doc/xml.html: applied a patch from Stefan Kost for namesapce docs * doc/xml.html: applied a patch from Stefan Kost for namespace docs
Sat Oct 18 12:46:02 HKT 2003 William Brack <wbrack@mmm.com.hk> Sat Oct 18 12:46:02 HKT 2003 William Brack <wbrack@mmm.com.hk>
@ -9179,7 +9179,7 @@ Tue Oct 7 23:19:39 CEST 2003 Daniel Veillard <daniel@veillard.com>
on Windows from Jesse Pelton on Windows from Jesse Pelton
* parser.c: tiny safety patch for xmlStrPrintf() make sure the * parser.c: tiny safety patch for xmlStrPrintf() make sure the
return is always zero terminated. Should also help detecting return is always zero terminated. Should also help detecting
passing wrong buffer size easilly. passing wrong buffer size easily.
* result/VC/* result/valid/rss.xml.err result/valid/xlink.xml.err: * result/VC/* result/valid/rss.xml.err result/valid/xlink.xml.err:
updated the results to follow the errors string generated by updated the results to follow the errors string generated by
last commit. last commit.
@ -9192,7 +9192,7 @@ Tue Oct 7 14:16:45 CEST 2003 Daniel Veillard <daniel@veillard.com>
Tue Oct 7 13:30:39 CEST 2003 Daniel Veillard <daniel@veillard.com> Tue Oct 7 13:30:39 CEST 2003 Daniel Veillard <daniel@veillard.com>
* error.c relaxng.c include/libxml/xmlerror.h: switched Relax-NG * error.c relaxng.c include/libxml/xmlerror.h: switched Relax-NG
module to teh new error reporting. Better default report, adds module to the new error reporting. Better default report, adds
the element associated if found, context and node are included the element associated if found, context and node are included
in the xmlError in the xmlError
* python/tests/reader2.py: the error messages changed. * python/tests/reader2.py: the error messages changed.
@ -10424,7 +10424,7 @@ Fri Jun 13 14:27:19 CEST 2003 Daniel Veillard <daniel@veillard.com>
* doc/Makefile.am doc/html/*: reverted back patch for #113521, * doc/Makefile.am doc/html/*: reverted back patch for #113521,
due to #115104 and while fixing #115101 . HTML URLs must not due to #115104 and while fixing #115101 . HTML URLs must not
be version dependant. be version dependent.
Fri Jun 13 12:03:30 CEST 2003 Daniel Veillard <daniel@veillard.com> Fri Jun 13 12:03:30 CEST 2003 Daniel Veillard <daniel@veillard.com>
@ -10627,7 +10627,7 @@ Sat Apr 26 14:00:58 CEST 2003 Daniel Veillard <daniel@veillard.com>
* python/generator.py: fixed a problem in the generator where * python/generator.py: fixed a problem in the generator where
the way functions are remapped as methods on classes was the way functions are remapped as methods on classes was
not symetric and dependant on python internal hash order, not symmetric and dependent on python internal hash order,
as reported by Stéphane Bidoul as reported by Stéphane Bidoul
Fri Apr 25 21:52:33 MDT 2003 John Fleck <jfleck@inkstain.net> Fri Apr 25 21:52:33 MDT 2003 John Fleck <jfleck@inkstain.net>
@ -11162,7 +11162,7 @@ Tue Mar 18 01:28:15 CET 2003 Daniel Veillard <daniel@veillard.com>
Mon Mar 17 16:34:07 CET 2003 Daniel Veillard <daniel@veillard.com> Mon Mar 17 16:34:07 CET 2003 Daniel Veillard <daniel@veillard.com>
* relaxng.c: fixed the last core RelaxNG bug known #107083, * relaxng.c: fixed the last core RelaxNG bug known #107083,
shemas datatype ID/IDREF support still missing though. schemas datatype ID/IDREF support still missing though.
* xmlreader.c: fix a crashing bug with prefix raised by * xmlreader.c: fix a crashing bug with prefix raised by
Merijn Broeren Merijn Broeren
* test/relaxng/testsuite.xml: augmented the testsuite with * test/relaxng/testsuite.xml: augmented the testsuite with
@ -11882,7 +11882,7 @@ Fri Jan 10 13:47:55 CET 2003 Daniel Veillard <daniel@veillard.com>
Fri Jan 10 00:16:49 CET 2003 Daniel Veillard <daniel@veillard.com> Fri Jan 10 00:16:49 CET 2003 Daniel Veillard <daniel@veillard.com>
* parser.c: one more IsEmptyElement crazyness, that time in * parser.c: one more IsEmptyElement craziness, that time in
external parsed entities if substitution is asked. external parsed entities if substitution is asked.
* python/tests/reader3.py: added a specific test. * python/tests/reader3.py: added a specific test.
@ -12145,7 +12145,7 @@ Wed Dec 25 19:22:06 MST 2002 John Fleck <jfleck@inkstain.net>
Mon Dec 23 16:54:22 CET 2002 Daniel Veillard <daniel@veillard.com> Mon Dec 23 16:54:22 CET 2002 Daniel Veillard <daniel@veillard.com>
* xmlreader.c: Fixed the empty node detection to avoid reporting * xmlreader.c: Fixed the empty node detection to avoid reporting
an inexistant close tag. an nonexistent close tag.
Mon Dec 23 15:42:24 CET 2002 Daniel Veillard <daniel@veillard.com> Mon Dec 23 15:42:24 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -12482,7 +12482,7 @@ Sat Nov 16 16:30:25 CET 2002 Daniel Veillard <daniel@veillard.com>
* parser.c xpath.c: fixing #96925 wich was also dependent on the * parser.c xpath.c: fixing #96925 wich was also dependent on the
processing of parsed entities, and XPath computation on sustitued processing of parsed entities, and XPath computation on sustitued
entities. entities.
* testXPath.c: make sure entities are substitued. * testXPath.c: make sure entities are substituted.
Fri Nov 15 16:22:54 CET 2002 Daniel Veillard <daniel@veillard.com> Fri Nov 15 16:22:54 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -12673,7 +12673,7 @@ Tue Oct 22 16:23:57 CEST 2002 Daniel Veillard <daniel@veillard.com>
Mon Oct 21 09:57:10 CEST 2002 Daniel Veillard <daniel@veillard.com> Mon Oct 21 09:57:10 CEST 2002 Daniel Veillard <daniel@veillard.com>
* parser.c: tried to fix bug #91500 where doc->children may * parser.c: tried to fix bug #91500 where doc->children may
be overriden by a call to xmlParseBalancedChunkMemory() be overridden by a call to xmlParseBalancedChunkMemory()
Mon Oct 21 09:04:32 CEST 2002 Daniel Veillard <daniel@veillard.com> Mon Oct 21 09:04:32 CEST 2002 Daniel Veillard <daniel@veillard.com>
@ -12800,7 +12800,7 @@ Thu Sep 26 19:48:06 CEST 2002 Daniel Veillard <daniel@veillard.com>
* configure.in include/libxml/xmlwin32version.h: preparing release * configure.in include/libxml/xmlwin32version.h: preparing release
of 2.4.25 of 2.4.25
* doc/*: updated and regenerated teh docs and web pages. * doc/*: updated and regenerated the docs and web pages.
Thu Sep 26 17:33:46 CEST 2002 Daniel Veillard <daniel@veillard.com> Thu Sep 26 17:33:46 CEST 2002 Daniel Veillard <daniel@veillard.com>
@ -13026,7 +13026,7 @@ Thu Sep 5 10:07:13 CEST 2002 Daniel Veillard <daniel@veillard.com>
Wed Sep 4 14:13:34 CEST 2002 Daniel Veillard <daniel@veillard.com> Wed Sep 4 14:13:34 CEST 2002 Daniel Veillard <daniel@veillard.com>
* libxml.spec.in: fixes libary path for x86_64 AMD * libxml.spec.in: fixes library path for x86_64 AMD
Tue Sep 3 21:14:19 MDT 2002 John Fleck <jfleck@inkstain.net> Tue Sep 3 21:14:19 MDT 2002 John Fleck <jfleck@inkstain.net>
@ -13085,7 +13085,7 @@ Thu Aug 22 16:19:42 CEST 2002 Daniel Veillard <daniel@veillard.com>
Thu Aug 22 11:45:50 CEST 2002 Daniel Veillard <daniel@veillard.com> Thu Aug 22 11:45:50 CEST 2002 Daniel Veillard <daniel@veillard.com>
* python/Makefile.am: typo in target name resulted in libxml2.py * python/Makefile.am: typo in target name resulted in libxml2.py
to not be rebuilt. fixed DESTDIR similary to the libxslt one. to not be rebuilt. fixed DESTDIR similarly to the libxslt one.
Thu Aug 22 09:15:00 CEST 2002 Daniel Veillard <daniel@veillard.com> Thu Aug 22 09:15:00 CEST 2002 Daniel Veillard <daniel@veillard.com>
@ -14044,7 +14044,7 @@ Thu Mar 7 16:11:35 CET 2002 Daniel Veillard <daniel@veillard.com>
Thu Mar 7 12:19:36 CET 2002 Daniel Veillard <daniel@veillard.com> Thu Mar 7 12:19:36 CET 2002 Daniel Veillard <daniel@veillard.com>
* configure.in xmllint.c: trying to fix #71457 for timing * configure.in xmllint.c: trying to fix #71457 for timing
precision when gettimeofday() is not availble but ftime() is precision when gettimeofday() is not available but ftime() is
Thu Mar 7 11:24:02 CET 2002 Daniel Veillard <daniel@veillard.com> Thu Mar 7 11:24:02 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -14208,7 +14208,7 @@ Tue Feb 19 22:01:35 CET 2002 Daniel Veillard <daniel@veillard.com>
when a document is standalone seems correctly handled. There when a document is standalone seems correctly handled. There
is a couple of open issues left which need consideration especially is a couple of open issues left which need consideration especially
PE93 on external unparsed entities and standalone status. PE93 on external unparsed entities and standalone status.
Ran 1819 tests: 1817 suceeded, 2 failed and 0 generated an error in 8.26 s. Ran 1819 tests: 1817 succeeded, 2 failed and 0 generated an error in 8.26 s.
The 2 tests left failing are actually in error. Cleanup done. The 2 tests left failing are actually in error. Cleanup done.
Tue Feb 19 15:17:02 CET 2002 Daniel Veillard <daniel@veillard.com> Tue Feb 19 15:17:02 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -14225,7 +14225,7 @@ Mon Feb 18 23:25:08 CET 2002 Daniel Veillard <daniel@veillard.com>
* parser.c valid.c: a couple of errors were reported but not * parser.c valid.c: a couple of errors were reported but not
saved back as such in the parsing context. Down to 1% failure rate saved back as such in the parsing context. Down to 1% failure rate
Ran 1819 tests: 1801 suceeded, 18 failed and 0 generated an error Ran 1819 tests: 1801 succeeded, 18 failed and 0 generated an error
Mon Feb 18 20:16:15 CET 2002 Daniel Veillard <daniel@veillard.com> Mon Feb 18 20:16:15 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -14266,7 +14266,7 @@ Sun Feb 17 23:45:40 CET 2002 Daniel Veillard <daniel@veillard.com>
* check-xml-test-suite.py: improved the behaviour a bit as * check-xml-test-suite.py: improved the behaviour a bit as
well as the logs well as the logs
* parser.c valid.c SAX.c: fixed a few more bugs * parser.c valid.c SAX.c: fixed a few more bugs
"Ran 1819 tests: 1778 suceeded, 41 failed, and 0 generated an error" "Ran 1819 tests: 1778 succeeded, 41 failed, and 0 generated an error"
Sun Feb 17 20:41:37 CET 2002 Daniel Veillard <daniel@veillard.com> Sun Feb 17 20:41:37 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -14453,7 +14453,7 @@ Sun Feb 3 17:50:46 CET 2002 Daniel Veillard <daniel@veillard.com>
context, allow to switch on and check validity context, allow to switch on and check validity
* python/tests/Makefile.am python/tests/error.py * python/tests/Makefile.am python/tests/error.py
python/tests/invalid.xml python/tests/valid.xml python/tests/invalid.xml python/tests/valid.xml
python/tests/validate.py: attded more test and and added error.py python/tests/validate.py: added more test and added error.py
which I forgot to commit in the last step which I forgot to commit in the last step
Sun Feb 3 16:03:55 CET 2002 Daniel Veillard <daniel@veillard.com> Sun Feb 3 16:03:55 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -14576,7 +14576,7 @@ Wed Jan 23 18:53:55 CET 2002 Daniel Veillard <daniel@veillard.com>
Wed Jan 23 15:14:22 CET 2002 Daniel Veillard <daniel@veillard.com> Wed Jan 23 15:14:22 CET 2002 Daniel Veillard <daniel@veillard.com>
* parserInternals.h: Greg Sjaardema suggested to use an * parserInternals.h: Greg Sjaardema suggested to use an
eponential buffer groth policy in xmlParserAddNodeInfo() exponential buffer growth policy in xmlParserAddNodeInfo()
Wed Jan 23 13:32:40 CET 2002 Daniel Veillard <daniel@veillard.com> Wed Jan 23 13:32:40 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -14660,7 +14660,7 @@ Sat Jan 19 16:36:21 CET 2002 Bjorn Reese <breese@users.sourceforge.net>
Fri Jan 18 17:22:50 CET 2002 Daniel Veillard <daniel@veillard.com> Fri Jan 18 17:22:50 CET 2002 Daniel Veillard <daniel@veillard.com>
* globals.c xmlIO.c xmlcatalog.c: removed the last occurences * globals.c xmlIO.c xmlcatalog.c: removed the last occurrences
of strdup usage in the code of strdup usage in the code
Fri Jan 18 12:47:15 CET 2002 Daniel Veillard <daniel@veillard.com> Fri Jan 18 12:47:15 CET 2002 Daniel Veillard <daniel@veillard.com>
@ -15488,7 +15488,7 @@ Wed Sep 12 16:58:16 CEST 2001 Daniel Veillard <daniel@veillard.com>
Tue Sep 11 11:25:36 CEST 2001 Daniel Veillard <daniel@veillard.com> Tue Sep 11 11:25:36 CEST 2001 Daniel Veillard <daniel@veillard.com>
* parser.c result/noent/wml.xml: fixed bug #59981 related * parser.c result/noent/wml.xml: fixed bug #59981 related
to handling of '&' in attributes when entities are substitued to handling of '&' in attributes when entities are substituted
Mon Sep 10 22:14:42 CEST 2001 Daniel Veillard <daniel@veillard.com> Mon Sep 10 22:14:42 CEST 2001 Daniel Veillard <daniel@veillard.com>
@ -16120,7 +16120,7 @@ Tue Jun 26 18:05:26 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* configure.in doc/xml.html include/libxml/xmlwin32version.h: * configure.in doc/xml.html include/libxml/xmlwin32version.h:
release of 2.3.12 release of 2.3.12
* parser.c: make an error message if unknow entities in all cases * parser.c: make an error message if unknown entities in all cases
Tue Jun 26 09:46:29 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Tue Jun 26 09:46:29 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
@ -16943,7 +16943,7 @@ Wed Apr 18 17:09:15 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
Wed Apr 18 15:06:30 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Wed Apr 18 15:06:30 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* debugXML.c hash.c tree.h valid.c : some changes related to * debugXML.c hash.c tree.h valid.c : some changes related to
the validation suport to improve speed with DocBook the validation support to improve speed with DocBook
* result/VC/OneID2 result/VC/OneID3 : this slightly changes * result/VC/OneID2 result/VC/OneID3 : this slightly changes
the way validation errors get reported the way validation errors get reported
@ -17003,7 +17003,7 @@ Tue Apr 10 18:13:10 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpath.c: trying to get 52979 solved * xpath.c: trying to get 52979 solved
* tree.c result/ result/noent/: trying to get 52712 solved, this * tree.c result/ result/noent/: trying to get 52712 solved, this
also made me clean up the fact that XML output in general should also made me clean up the fact that XML output in general should
not add formating blanks by default, this changed the output of not add formatting blanks by default, this changed the output of
a few tests a few tests
Tue Apr 10 16:30:20 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Tue Apr 10 16:30:20 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
@ -17219,7 +17219,7 @@ Wed Mar 7 20:43:47 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* parser.c SAX.c: the new content parsing code raised an * parser.c SAX.c: the new content parsing code raised an
ugly bug in the characters() SAX callback. Found it ugly bug in the characters() SAX callback. Found it
just because of strangeness in XSLT XML Rec ouptut :-( just because of strangeness in XSLT XML Rec output :-(
Wed Mar 7 16:50:22 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Wed Mar 7 16:50:22 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
@ -17541,13 +17541,13 @@ Mon Jan 22 16:30:37 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
Mon Jan 22 11:43:21 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Mon Jan 22 11:43:21 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpath.c: when copying a XSLT tree object teh tree need to be copied * xpath.c: when copying a XSLT tree object the tree need to be copied
too, and deallocation need to occur the same way. too, and deallocation need to occur the same way.
Mon Jan 22 10:35:40 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Mon Jan 22 10:35:40 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpathInternals.h xpath.[ch] debugXML.c: added the XPATH_XSLT_TREE * xpathInternals.h xpath.[ch] debugXML.c: added the XPATH_XSLT_TREE
type correponding to an XSLT result tree fragment. Share most type corresponding to an XSLT result tree fragment. Share most
of the data format with node set, as well as operators. of the data format with node set, as well as operators.
* HTMLtree.c: added a newline at the end of the doctype output * HTMLtree.c: added a newline at the end of the doctype output
whe this one is not present initially. whe this one is not present initially.
@ -17904,7 +17904,7 @@ Sun Oct 15 22:28:32 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
Sun Oct 15 16:21:27 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> Sun Oct 15 16:21:27 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* SAX.c: HTML attributes need normalization too (Bjorn Reese) * SAX.c: HTML attributes need normalization too (Bjorn Reese)
* HTMLparser.[ch]: addded htmlIsScriptAttribute() * HTMLparser.[ch]: added htmlIsScriptAttribute()
Sun Oct 15 13:18:36 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> Sun Oct 15 13:18:36 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
@ -18010,7 +18010,7 @@ Wed Oct 11 02:53:10 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* include/Makefile.am include/win32config.h: new directory * include/Makefile.am include/win32config.h: new directory
for includes for includes
* win32/Makefile.mingw win32/README.MSDev win32/libxml2/libxml2.dsp * win32/Makefile.mingw win32/README.MSDev win32/libxml2/libxml2.dsp
updated teh makefiles and instructions for WIN32 updated the makefiles and instructions for WIN32
* xpath.c: small fixes * xpath.c: small fixes
* test/XPath/ results/XPath: updated the testcases and results * test/XPath/ results/XPath: updated the testcases and results
* HTMLparser.c nanohttp.c testXPath.c: incorporated provided or * HTMLparser.c nanohttp.c testXPath.c: incorporated provided or
@ -18255,7 +18255,7 @@ Mon Aug 28 11:58:12 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
patches from Wayne Davison <wayned@users.sourceforge.net>, patches from Wayne Davison <wayned@users.sourceforge.net>,
adding htmlEncodeEntities() adding htmlEncodeEntities()
* HTMLparser.c: fixed an ignorable white space detection bug * HTMLparser.c: fixed an ignorable white space detection bug
occuring when parsing with SAX only occurring when parsing with SAX only
* result/HTML/*.sax: updated since the output is now HTML * result/HTML/*.sax: updated since the output is now HTML
encoded... encoded...
@ -18420,7 +18420,7 @@ Fri Jul 14 16:12:20 MEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
when using Sun Pro cc compiler when using Sun Pro cc compiler
* xpath.c : cleanup memleaks * xpath.c : cleanup memleaks
* nanoftp.c : added a TESTING preprocessor flag for standalong * nanoftp.c : added a TESTING preprocessor flag for standalong
compile so that people can report bugs more easilly compile so that people can report bugs more easily
* nanohttp.c : ditched socklen_t which was a portability mess * nanohttp.c : ditched socklen_t which was a portability mess
and replaced it with unsigned int. and replaced it with unsigned int.
* tree.[ch]: added xmlHasProp() * tree.[ch]: added xmlHasProp()
@ -18594,7 +18594,7 @@ Mon Apr 3 21:47:10 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
Makefile.am : added compile-time customization of libxml Makefile.am : added compile-time customization of libxml
--with-ftp --with-http --with-html --with-xpath --with-debug --with-ftp --with-http --with-html --with-xpath --with-debug
--with-mem-debug --with-mem-debug
* *.[ch] autoconf.sh : moved to an absolute adressing of includes : * *.[ch] autoconf.sh : moved to an absolute addressing of includes :
#include <libxml/xxx.h> I hope it won't break too much stuff #include <libxml/xxx.h> I hope it won't break too much stuff
and will be manageable in the future... and will be manageable in the future...
* xmllint.c Makefile.am libxml.spec.in : renamed tester.c to xmllint.c * xmllint.c Makefile.am libxml.spec.in : renamed tester.c to xmllint.c
@ -18625,7 +18625,7 @@ Mon Mar 20 12:33:51 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
libxml default allocation function with another set (like gmalloc/ libxml default allocation function with another set (like gmalloc/
gfree). gfree).
* Makefile.am, uri.c, uri.h: added a set of functions to do * Makefile.am, uri.c, uri.h: added a set of functions to do
exact (litteraly copied from the RFC 2396 productions) parsing exact (literally copied from the RFC 2396 productions) parsing
and handling of URI. Will be needed for XLink, one XML WFC, and handling of URI. Will be needed for XLink, one XML WFC,
XML Base and reused in the nano[ftp/http] modules. Still work XML Base and reused in the nano[ftp/http] modules. Still work
to be done. to be done.
@ -18688,7 +18688,7 @@ Thu Feb 3 15:59:37 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* nanoftp.c nanohttp.c tree.c HTMLtree.[ch] debugXML.c xpath.c: Fixed * nanoftp.c nanohttp.c tree.c HTMLtree.[ch] debugXML.c xpath.c: Fixed
compilation warnings on various platforms. compilation warnings on various platforms.
* parser.c: Fixed #5281 validity error callbacks are now desactived * parser.c: Fixed #5281 validity error callbacks are now deactivated
by default if not validating. by default if not validating.
Thu Feb 3 13:46:14 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org> Thu Feb 3 13:46:14 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
@ -19125,7 +19125,7 @@ Wed Sep 22 11:40:31 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.h: modified the parser context struct to regain 1.4.0 * parser.h: modified the parser context struct to regain 1.4.0
binary compatibility binary compatibility
* parser.c, xml-error.h: added errno ot teh context and defined * parser.c, xml-error.h: added errno to the context and defined
a set of errors values with update of errno a set of errors values with update of errno
* nanohttp.[ch]: minimalist HTTP front-end for fetching remote * nanohttp.[ch]: minimalist HTTP front-end for fetching remote
DTDs and entities DTDs and entities
@ -19562,7 +19562,7 @@ Tue Oct 27 01:15:39 EST 1998 Daniel Veillard <Daniel.Veillard@w3.org>
Sat Oct 24 14:23:51 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org> Sat Oct 24 14:23:51 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.c: Set up the fonctions comment block, boring but useful. * parser.c: Set up the functions comment block, boring but useful.
* parser.h, SAX.c, parser.c: now attributes are processed through * parser.h, SAX.c, parser.c: now attributes are processed through
the SAX interface. The problem is that my SAX interface diverged the SAX interface. The problem is that my SAX interface diverged
quite a bit from the original one, well this is not an official quite a bit from the original one, well this is not an official
@ -19571,7 +19571,7 @@ Sat Oct 24 14:23:51 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
Tue Oct 20 02:11:21 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org> Tue Oct 20 02:11:21 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* SAX.c, entities.c, tree.c, encoding.c, error.c: Set up the * SAX.c, entities.c, tree.c, encoding.c, error.c: Set up the
fonctions comment block, boring but useful. functions comment block, boring but useful.
Sun Oct 18 20:40:58 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org> Sun Oct 18 20:40:58 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>

View file

@ -317,7 +317,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
#define SKIP_BLANKS htmlSkipBlankChars(ctxt) #define SKIP_BLANKS htmlSkipBlankChars(ctxt)
/* Inported from XML */ /* Imported from XML */
/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */ /* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */
#define CUR ((int) (*ctxt->input->cur)) #define CUR ((int) (*ctxt->input->cur))
@ -537,7 +537,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
encoding_error: encoding_error:
/* /*
* If we detect an UTF8 error that probably mean that the * If we detect an UTF8 error that probably mean that the
* input encoding didn't get properly advertized in the * input encoding didn't get properly advertised in the
* declaration header. Report the error and switch the encoding * declaration header. Report the error and switch the encoding
* to ISO-Latin-1 (if you don't like this policy, just declare the * to ISO-Latin-1 (if you don't like this policy, just declare the
* encoding !) * encoding !)
@ -602,8 +602,8 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
************************************************************************/ ************************************************************************/
/* /*
* Start Tag: 1 means the start tag can be ommited * Start Tag: 1 means the start tag can be omitted
* End Tag: 1 means the end tag can be ommited * End Tag: 1 means the end tag can be omitted
* 2 means it's forbidden (empty elements) * 2 means it's forbidden (empty elements)
* 3 means the tag is stylistic and should be closed easily * 3 means the tag is stylistic and should be closed easily
* Depr: this element is deprecated * Depr: this element is deprecated
@ -1342,7 +1342,7 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag)
if (xmlStrEqual(newtag, ctxt->nameTab[i])) if (xmlStrEqual(newtag, ctxt->nameTab[i]))
break; break;
/* /*
* A missplaced endtag can only close elements with lower * A misplaced endtag can only close elements with lower
* or equal priority, so if we find an element with higher * or equal priority, so if we find an element with higher
* priority before we find an element with * priority before we find an element with
* matching name, we just ignore this endtag * matching name, we just ignore this endtag
@ -2176,6 +2176,7 @@ htmlEncodeEntities(unsigned char* out, int *outlen,
* * * *
************************************************************************/ ************************************************************************/
#ifdef LIBXML_PUSH_ENABLED
/** /**
* htmlNewInputStream: * htmlNewInputStream:
* @ctxt: an HTML parser context * @ctxt: an HTML parser context
@ -2207,6 +2208,7 @@ htmlNewInputStream(htmlParserCtxtPtr ctxt) {
input->length = 0; input->length = 0;
return(input); return(input);
} }
#endif
/************************************************************************ /************************************************************************
@ -2216,9 +2218,9 @@ htmlNewInputStream(htmlParserCtxtPtr ctxt) {
************************************************************************/ ************************************************************************/
/* /*
* all tags allowing pc data from the html 4.01 loose dtd * all tags allowing pc data from the html 4.01 loose dtd
* NOTE: it might be more apropriate to integrate this information * NOTE: it might be more appropriate to integrate this information
* into the html40ElementTable array but I don't want to risk any * into the html40ElementTable array but I don't want to risk any
* binary incomptibility * binary incompatibility
*/ */
static const char *allowPCData[] = { static const char *allowPCData[] = {
"a", "abbr", "acronym", "address", "applet", "b", "bdo", "big", "a", "abbr", "acronym", "address", "applet", "b", "bdo", "big",
@ -2959,6 +2961,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
} }
COPY_BUF(l,buf,nbchar,cur); COPY_BUF(l,buf,nbchar,cur);
if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
buf[nbchar] = 0;
if (ctxt->sax->cdataBlock!= NULL) { if (ctxt->sax->cdataBlock!= NULL) {
/* /*
* Insert as CDATA, which is the same as HTML_PRESERVE_NODE * Insert as CDATA, which is the same as HTML_PRESERVE_NODE
@ -2983,6 +2986,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
} }
if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
buf[nbchar] = 0;
if (ctxt->sax->cdataBlock!= NULL) { if (ctxt->sax->cdataBlock!= NULL) {
/* /*
* Insert as CDATA, which is the same as HTML_PRESERVE_NODE * Insert as CDATA, which is the same as HTML_PRESERVE_NODE
@ -3028,6 +3032,8 @@ htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
COPY_BUF(l,buf,nbchar,cur); COPY_BUF(l,buf,nbchar,cur);
} }
if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
buf[nbchar] = 0;
/* /*
* Ok the segment is to be consumed as chars. * Ok the segment is to be consumed as chars.
*/ */
@ -5762,13 +5768,13 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
break; break;
} }
case XML_PARSER_CONTENT: { case XML_PARSER_CONTENT: {
xmlChar chr[2] = { 0, 0 };
long cons; long cons;
/* /*
* Handle preparsed entities and charRef * Handle preparsed entities and charRef
*/ */
if (ctxt->token != 0) { if (ctxt->token != 0) {
xmlChar chr[2] = { 0 , 0 } ;
chr[0] = (xmlChar) ctxt->token; chr[0] = (xmlChar) ctxt->token;
htmlCheckParagraph(ctxt); htmlCheckParagraph(ctxt);
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
@ -5780,21 +5786,22 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
cur = in->cur[0]; cur = in->cur[0];
if ((cur != '<') && (cur != '&')) { if ((cur != '<') && (cur != '&')) {
if (ctxt->sax != NULL) { if (ctxt->sax != NULL) {
chr[0] = cur;
if (IS_BLANK_CH(cur)) { if (IS_BLANK_CH(cur)) {
if (ctxt->keepBlanks) { if (ctxt->keepBlanks) {
if (ctxt->sax->characters != NULL) if (ctxt->sax->characters != NULL)
ctxt->sax->characters( ctxt->sax->characters(
ctxt->userData, &in->cur[0], 1); ctxt->userData, chr, 1);
} else { } else {
if (ctxt->sax->ignorableWhitespace != NULL) if (ctxt->sax->ignorableWhitespace != NULL)
ctxt->sax->ignorableWhitespace( ctxt->sax->ignorableWhitespace(
ctxt->userData, &in->cur[0], 1); ctxt->userData, chr, 1);
} }
} else { } else {
htmlCheckParagraph(ctxt); htmlCheckParagraph(ctxt);
if (ctxt->sax->characters != NULL) if (ctxt->sax->characters != NULL)
ctxt->sax->characters( ctxt->sax->characters(
ctxt->userData, &in->cur[0], 1); ctxt->userData, chr, 1);
} }
} }
ctxt->token = 0; ctxt->token = 0;

View file

@ -1048,7 +1048,7 @@ htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
* @cur: the document * @cur: the document
* @encoding: the encoding string * @encoding: the encoding string
* *
* Dump an HTML document. Formating return/spaces are added. * Dump an HTML document. Formatting return/spaces are added.
*/ */
void void
htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,

View file

@ -8,8 +8,451 @@ The change log at
ChangeLog.html ChangeLog.html
describes the recents commits describes the recents commits
to the GIT at to the GIT at
http://git.gnome.org/browse/libxml2/ https://gitlab.gnome.org/GNOME/libxml2
code base.Here is the list of public releases: code base.Here is the list of public releases:
v2.9.9: Jan 03 2019:
- Security:
CVE-2018-9251 CVE-2018-14567 Fix infinite loop in LZMA decompression (Nick Wellnhofer),
CVE-2018-14404 Fix nullptr deref with XPath logic ops (Nick Wellnhofer),
- Documentation:
reader: Fix documentation comment (Mohammed Sadiq)
- Portability:
Fix MSVC build with lzma (Nick Wellnhofer),
Variables need 'extern' in static lib on Cygwin (Michael Haubenwallner),
Really declare dllexport/dllimport for Cygwin (Michael Haubenwallner),
Merge branch 'patch-2' into 'master' (Nick Wellnhofer),
Change dir to $THEDIR after ACLOCAL_PATH check autoreconf creates aclocal.m4 in $srcdir (Vitaly Buka),
Improve error message if pkg.m4 couldn't be found (Nick Wellnhofer),
NaN and Inf fixes for pre-C99 compilers (Nick Wellnhofer)
- Bug Fixes:
Revert "Support xmlTextReaderNextSibling w/o preparsed doc" (Nick Wellnhofer),
Fix building relative URIs (Thomas Holder),
Problem with data in interleave in RelaxNG validation (Nikolai Weibull),
Fix memory leak in xmlSwitchInputEncodingInt error path (Nick Wellnhofer),
Set doc on element obtained from freeElems (Nick Wellnhofer),
Fix HTML serialization with UTF-8 encoding (Nick Wellnhofer),
Use actual doc in xmlTextReaderRead*Xml (Nick Wellnhofer),
Unlink node before freeing it in xmlSAX2StartElement (Nick Wellnhofer),
Check return value of nodePush in xmlSAX2StartElement (Nick Wellnhofer),
Free input buffer in xmlHaltParser (Nick Wellnhofer),
Reset HTML parser input pointers on encoding failure (Nick Wellnhofer),
Don't run icu_parse_test if EUC-JP is unsupported (Nick Wellnhofer),
Fix xmlSchemaValidCtxtPtr reuse memory leak (Greg Hildstrom),
Fix xmlTextReaderNext with preparsed document (Felix Bünemann),
Remove stray character from comment (Nick Wellnhofer),
Remove a misleading line from xmlCharEncOutput (Andrey Bienkowski),
HTML noscript should not close p (Daniel Veillard),
Don't change context node in xmlXPathRoot (Nick Wellnhofer),
Stop using XPATH_OP_RESET (Nick Wellnhofer),
Revert "Change calls to xmlCharEncInput to set flush false" (Nick Wellnhofer)
- Improvements:
Fix "Problem with data in interleave in RelaxNG validation" (Nikolai Weibull),
cleanup: remove some unreachable code (Thomas Holder),
add --relative to testURI (Thomas Holder),
Remove redefined starts and defines inside include elements (Nikolai Weibull),
Allow choice within choice in nameClass in RELAX NG (Nikolai Weibull),
Look inside divs for starts and defines inside include (Nikolai Weibull),
Add compile and libxml2-config.cmake to .gitignore (Nikolai Weibull),
Stop using doc->charset outside parser code (Nick Wellnhofer),
Add newlines to 'xmllint --xpath' output (Nick Wellnhofer),
Don't include SAX.h from globals.h (Nick Wellnhofer),
Support xmlTextReaderNextSibling w/o preparsed doc (Felix Bünemann),
Don't instruct user to run make when autogen.sh failed (林博仁(Buo-ren Lin)),
Run Travis ASan tests with "sudo: required" (Nick Wellnhofer),
Improve restoring of context size and position (Nick Wellnhofer),
Simplify and harden nodeset filtering (Nick Wellnhofer),
Avoid unnecessary backups of the context node (Nick Wellnhofer),
Fix inconsistency in xmlXPathIsInf (Nick Wellnhofer)
- Cleanups:
v2.9.8: Mar 05 2018:
- Portability:
python: remove single use of _PyVerify_fd (Patrick Welche),
Build more test executables on Windows/MSVC (Nick Wellnhofer),
Stop including ansidecl.h (Nick Wellnhofer),
Fix libz and liblzma detection (Nick Wellnhofer),
Revert "Compile testapi with -Wno-unused-function" (Nick Wellnhofer)
- Bug Fixes:
Fix xmlParserEntityCheck (Nick Wellnhofer),
Halt parser in case of encoding error (Nick Wellnhofer),
Clear entity content in case of errors (Nick Wellnhofer),
Change calls to xmlCharEncInput to set flush false when not final call. Having flush incorrectly set to true causes errors for ICU. (Joel Hockey),
Fix buffer over-read in xmlParseNCNameComplex (Nick Wellnhofer),
Fix ICU library filenames on Windows/MSVC (Nick Wellnhofer),
Fix xmlXPathIsNaN broken by recent commit (Nick Wellnhofer),
Fix -Wenum-compare warnings (Nick Wellnhofer),
Fix callback signature in testapi.c (Nick Wellnhofer),
Fix unused parameter warning without ICU (Nick Wellnhofer),
Fix IO callback signatures (Nick Wellnhofer),
Fix misc callback signatures (Nick Wellnhofer),
Fix list callback signatures (Nick Wellnhofer),
Fix hash callback signatures (Nick Wellnhofer),
Refactor name and type signature for xmlNop (Vlad Tsyrklevich),
Fixed ICU to set flush correctly and provide pivot buffer. (Joel Hockey),
Skip EBCDIC tests if EBCDIC isn't supported (Nick Wellnhofer)
- Improvements:
Disable pointer-overflow UBSan checks under Travis (Nick Wellnhofer),
Improve handling of context input_id (Daniel Veillard),
Add resource file to Windows DLL (ccpaging),
Run Travis tests with -Werror (Nick Wellnhofer),
Build with "-Wall -Wextra" (Nick Wellnhofer),
Fix -Wtautological-pointer-compare warnings (Nick Wellnhofer),
Remove unused AC_CHECKs (Nick Wellnhofer),
Update information about contributing (Nick Wellnhofer),
Fix -Wmisleading-indentation warnings (Nick Wellnhofer),
Don't touch CFLAGS in configure.ac (Nick Wellnhofer),
Ignore function pointer cast warnings (Nick Wellnhofer),
Simplify XPath NaN, inf and -0 handling (Nick Wellnhofer),
Introduce xmlPosixStrdup and update xmlMemStrdup (Nick Wellnhofer),
Add test for ICU flush and pivot buffer (Nick Wellnhofer),
Compile testapi with -Wno-unused-function (Nick Wellnhofer)
2.9.7: Nov 02 2017:
- Documentation:
xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)
- Portability:
Fix deprecated Travis compiler flag (Nick Wellnhofer),
Add declaration for DllMain (J. Peter Mugaas),
Fix preprocessor conditional in threads.h (J. Peter Mugaas),
Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas),
Fix macro redefinition warning (J. Peter Mugaas),
Default to native threads on MinGW-w64 (Nick Wellnhofer),
Simplify Windows IO functions (Nick Wellnhofer),
Fix runtest on Windows (Nick Wellnhofer),
socklen_t is always int on Windows (Nick Wellnhofer),
Don't redefine socket error codes on Windows (Nick Wellnhofer),
Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer),
Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer)
- Bug Fixes:
xmlcatalog: restore ability to query system catalog easily (Jan Pokorný),
Fix comparison of nodesets to strings (Nick Wellnhofer)
- Improvements:
Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer),
Fix mixed decls and code in timsort.h (Nick Wellnhofer),
Rework handling of return values in thread tests (Nick Wellnhofer),
Fix unused variable warnings in testrecurse (Nick Wellnhofer),
Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas),
Upgrade timsort.h to latest revision (Nick Wellnhofer),
Increase warning level to /W3 under MSVC (Nick Wellnhofer),
Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer),
Update .gitignore for Windows (Nick Wellnhofer),
Fix unused variable warnings in nanohttp.c (Nick Wellnhofer),
Fix the Windows header mess (Nick Wellnhofer),
Don't include winsock2.h in xmllint.c (Nick Wellnhofer),
Remove generated file python/setup.py from version control (Nick Wellnhofer),
Use __linux__ macro in generated code (Nick Wellnhofer)
v2.9.6: Oct 06 2017:
- Portability:
Change preprocessor OS tests to __linux__ (Nick Wellnhofer)
- Bug Fixes:
Fix XPath stack frame logic (Nick Wellnhofer),
Report undefined XPath variable error message (Nick Wellnhofer),
Fix regression with librsvg (Nick Wellnhofer),
Handle more invalid entity values in recovery mode (Nick Wellnhofer),
Fix structured validation errors (Nick Wellnhofer),
Fix memory leak in LZMA decompressor (Nick Wellnhofer),
Set memory limit for LZMA decompression (Nick Wellnhofer),
Handle illegal entity values in recovery mode (Nick Wellnhofer),
Fix debug dump of streaming XPath expressions (Nick Wellnhofer),
Fix memory leak in nanoftp (Nick Wellnhofer),
Fix memory leaks in SAX1 parser (Nick Wellnhofer)
v2.9.5: Sep 04 2017:
- Security:
Detect infinite recursion in parameter entities (Nick Wellnhofer),
Fix handling of parameter-entity references (Nick Wellnhofer),
Disallow namespace nodes in XPointer ranges (Nick Wellnhofer),
Fix XPointer paths beginning with range-to (Nick Wellnhofer)
- Documentation:
Documentation fixes (Nick Wellnhofer),
Spelling and grammar fixes (Nick Wellnhofer)
- Portability:
Adding README.zOS to list of extra files for the release (Daniel Veillard),
Description of work needed to compile on zOS (Stéphane Michaut),
Porting libxml2 on zOS encoding of code (Stéphane Michaut),
small changes for OS/400 (Patrick Monnerat),
relaxng.c, xmlschemas.c: Fix build on pre-C99 compilers (Chun-wei Fan)
- Bug Fixes:
Problem resolving relative URIs (Daniel Veillard),
Fix unwanted warnings when switching encodings (Nick Wellnhofer),
Fix signature of xmlSchemaAugmentImportedIDC (Daniel Veillard),
Heap-buffer-overflow read of size 1 in xmlFAParsePosCharGroup (David Kilzer),
Fix NULL pointer deref in xmlFAParseCharClassEsc (Nick Wellnhofer),
Fix infinite loops with push parser in recovery mode (Nick Wellnhofer),
Send xmllint usage error to stderr (Nick Wellnhofer),
Fix NULL deref in xmlParseExternalEntityPrivate (Nick Wellnhofer),
Make sure not to call IS_BLANK_CH when parsing the DTD (Nick Wellnhofer),
Fix xmlHaltParser (Nick Wellnhofer),
Fix pathological performance when outputting charrefs (Nick Wellnhofer),
Fix invalid-source-encoding warnings in testWriter.c (Nick Wellnhofer),
Fix duplicate SAX callbacks for entity content (David Kilzer),
Treat URIs with scheme as absolute in C14N (Nick Wellnhofer),
Fix copy-paste errors in error messages (Nick Wellnhofer),
Fix sanity check in htmlParseNameComplex (Nick Wellnhofer),
Fix potential infinite loop in xmlStringLenDecodeEntities (Nick Wellnhofer),
Reset parser input pointers on encoding failure (Nick Wellnhofer),
Fix memory leak in xmlParseEntityDecl error path (Nick Wellnhofer),
Fix xmlBuildRelativeURI for URIs starting with './' (Nick Wellnhofer),
Fix type confusion in xmlValidateOneNamespace (Nick Wellnhofer),
Fix memory leak in xmlStringLenGetNodeList (Nick Wellnhofer),
Fix NULL pointer deref in xmlDumpElementContent (Daniel Veillard),
Fix memory leak in xmlBufAttrSerializeTxtContent (Nick Wellnhofer),
Stop parser on unsupported encodings (Nick Wellnhofer),
Check for integer overflow in memory debug code (Nick Wellnhofer),
Fix buffer size checks in xmlSnprintfElementContent (Nick Wellnhofer),
Avoid reparsing in xmlParseStartTag2 (Nick Wellnhofer),
Fix undefined behavior in xmlRegExecPushStringInternal (Nick Wellnhofer),
Check XPath exponents for overflow (Nick Wellnhofer),
Check for overflow in xmlXPathIsPositionalPredicate (Nick Wellnhofer),
Fix spurious error message (Nick Wellnhofer),
Fix memory leak in xmlCanonicPath (Nick Wellnhofer),
Fix memory leak in xmlXPathCompareNodeSetValue (Nick Wellnhofer),
Fix memory leak in pattern error path (Nick Wellnhofer),
Fix memory leak in parser error path (Nick Wellnhofer),
Fix memory leaks in XPointer error paths (Nick Wellnhofer),
Fix memory leak in xmlXPathNodeSetMergeAndClear (Nick Wellnhofer),
Fix memory leak in XPath filter optimizations (Nick Wellnhofer),
Fix memory leaks in XPath error paths (Nick Wellnhofer),
Do not leak the new CData node if adding fails (David Tardon),
Prevent unwanted external entity reference (Neel Mehta),
Increase buffer space for port in HTTP redirect support (Daniel Veillard),
Fix more NULL pointer derefs in xpointer.c (Nick Wellnhofer),
Avoid function/data pointer conversion in xpath.c (Nick Wellnhofer),
Fix format string warnings (Nick Wellnhofer),
Disallow namespace nodes in XPointer points (Nick Wellnhofer),
Fix comparison with root node in xmlXPathCmpNodes (Nick Wellnhofer),
Fix attribute decoding during XML schema validation (Alex Henrie),
Fix NULL pointer deref in XPointer range-to (Nick Wellnhofer)
- Improvements:
Updating the spec file to reflect Fedora 24 (Daniel Veillard),
Add const in five places to move 1 KiB to .rdata (Bruce Dawson),
Fix missing part of comment for function xmlXPathEvalExpression() (Daniel Veillard),
Get rid of "blanks wrapper" for parameter entities (Nick Wellnhofer),
Simplify handling of parameter entity references (Nick Wellnhofer),
Deduplicate code in encoding.c (Nick Wellnhofer),
Make HTML parser functions take const pointers (Nick Wellnhofer),
Build test programs only when needed (Nick Wellnhofer),
Fix doc/examples/index.py (Nick Wellnhofer),
Fix compiler warnings in threads.c (Nick Wellnhofer),
Fix empty-body warning in nanohttp.c (Nick Wellnhofer),
Fix cast-align warnings (Nick Wellnhofer),
Fix unused-parameter warnings (Nick Wellnhofer),
Rework entity boundary checks (Nick Wellnhofer),
Don't switch encoding for internal parameter entities (Nick Wellnhofer),
Merge duplicate code paths handling PE references (Nick Wellnhofer),
Test SAX2 callbacks with entity substitution (Nick Wellnhofer),
Support catalog and threads tests under --without-sax1 (Nick Wellnhofer),
Misc fixes for 'make tests' (Nick Wellnhofer),
Initialize keepBlanks in HTML parser (Nick Wellnhofer),
Add test cases for bug 758518 (David Kilzer),
Fix compiler warning in htmlParseElementInternal (Nick Wellnhofer),
Remove useless check in xmlParseAttributeListDecl (Nick Wellnhofer),
Allow zero sized memory input buffers (Nick Wellnhofer),
Add TODO comment in xmlSwitchEncoding (Nick Wellnhofer),
Check for integer overflow in xmlXPathFormatNumber (Nick Wellnhofer),
Make Travis print UBSan stacktraces (Nick Wellnhofer),
Add .travis.yml (Nick Wellnhofer),
Fix expected error output in Python tests (Nick Wellnhofer),
Simplify control flow in xmlParseStartTag2 (Nick Wellnhofer),
Disable LeakSanitizer when running API tests (Nick Wellnhofer),
Avoid out-of-bound array access in API tests (Nick Wellnhofer),
Avoid spurious UBSan errors in parser.c (Nick Wellnhofer),
Parse small XPath numbers more accurately (Nick Wellnhofer),
Rework XPath rounding functions (Nick Wellnhofer),
Fix white space in test output (Nick Wellnhofer),
Fix axis traversal from attribute and namespace nodes (Nick Wellnhofer),
Check for trailing characters in XPath expressions earlier (Nick Wellnhofer),
Rework final handling of XPath results (Nick Wellnhofer),
Make xmlXPathEvalExpression call xmlXPathEval (Nick Wellnhofer),
Remove unused variables (Nick Wellnhofer),
Don't print generic error messages in XPath tests (Nick Wellnhofer)
- Cleanups:
Fix a couple of misleading indentation errors (Daniel Veillard),
Remove unnecessary calls to xmlPopInput (Nick Wellnhofer)
2.9.4: May 23 2016:
- Security:
More format string warnings with possible format string vulnerability (David Kilzer),
Avoid building recursive entities (Daniel Veillard),
Heap-based buffer overread in htmlCurrentChar (Pranjal Jumde),
Heap-based buffer-underreads due to xmlParseName (David Kilzer),
Heap use-after-free in xmlSAX2AttributeNs (Pranjal Jumde),
Heap use-after-free in htmlParsePubidLiteral and htmlParseSystemiteral (Pranjal Jumde),
Fix some format string warnings with possible format string vulnerability (David Kilzer),
Detect change of encoding when parsing HTML names (Hugh Davenport),
Fix inappropriate fetch of entities content (Daniel Veillard),
Bug 759398: Heap use-after-free in xmlDictComputeFastKey <https://bugzilla.gnome.org/show_bug.cgi?id=759398> (Pranjal Jumde),
Bug 758605: Heap-based buffer overread in xmlDictAddString <https://bugzilla.gnome.org/show_bug.cgi?id=758605> (Pranjal Jumde),
Bug 758588: Heap-based buffer overread in xmlParserPrintFileContextInternal <https://bugzilla.gnome.org/show_bug.cgi?id=758588> (David Kilzer),
Bug 757711: heap-buffer-overflow in xmlFAParsePosCharGroup <https://bugzilla.gnome.org/show_bug.cgi?id=757711> (Pranjal Jumde),
Add missing increments of recursion depth counter to XML parser. (Peter Simons)
- Documentation:
Fix typo: s{ ec -> cr }cipt (Jan Pokorný),
Fix typos: dictio{ nn -> n }ar{y,ies} (Jan Pokorný),
Fix typos: PATH_{ SEAPARATOR -> SEPARATOR } (Jan Pokorný),
Correct a typo. (Shlomi Fish)
- Portability:
Correct the usage of LDFLAGS (Mattias Hansson),
Revert the use of SAVE_LDFLAGS in configure.ac (Mattias Hansson),
libxml2 hardcodes -L/lib in zlib/lzma tests which breaks cross-compiles (Mike Frysinger),
Fix apibuild for a recently added construct (Daniel Veillard),
Use pkg-config to locate zlib when possible (Stewart Brodie),
Use pkg-config to locate ICU when possible (Stewart Brodie),
Portability to non C99 compliant compilers (Patrick Monnerat),
dict.h: Move xmlDictPtr definition before includes to allow direct inclusion. (Patrick Monnerat),
os400: tell about xmllint and xmlcatalog in README400. (Patrick Monnerat),
os400: properly process SGML add in XMLCATALOG command. (Patrick Monnerat),
os400: implement CL command XMLCATALOG. (Patrick Monnerat),
os400: compile and install program xmlcatalog (qshell-only). (Patrick Monnerat),
os400: expand tabs in sources, strip trailing blanks. (Patrick Monnerat),
os400: implement CL command XMLLINT. (Patrick Monnerat),
os400: compile and install program xmllint (qshell-only). (Patrick Monnerat),
os400: initscript make_module(): Use options instead of positional parameters. (Patrick Monnerat),
os400: c14n.rpgle: allow *omit for nullable reference parameters. (Patrick Monnerat),
os400: use like() for double type. (Patrick Monnerat),
os400: use like() for int type. (Patrick Monnerat),
os400: use like() for unsigned int type. (Patrick Monnerat),
os400: use like() for enum types. (Patrick Monnerat),
Add xz to xml2-config --libs output (Baruch Siach),
Bug 760190: configure.ac should be able to build --with-icu without icu-config tool <https://bugzilla.gnome.org/show_bug.cgi?id=760190> (David Kilzer),
win32\VC10\config.h and VS 2015 (Bruce Dawson),
Add configure maintainer mode (orzen)
- Bug Fixes:
Avoid an out of bound access when serializing malformed strings (Daniel Veillard),
Unsigned addition may overflow in xmlMallocAtomicLoc() (David Kilzer),
Integer signed/unsigned type mismatch in xmlParserInputGrow() (David Kilzer),
Bug 763071: heap-buffer-overflow in xmlStrncat <https://bugzilla.gnome.org/show_bug.cgi?id=763071> (Pranjal Jumde),
Integer overflow parsing port number in URI (Michael Paddon),
Fix an error with regexp on nullable counted char transition (Daniel Veillard),
Fix memory leak with XPath namespace nodes (Nick Wellnhofer),
Fix namespace axis traversal (Nick Wellnhofer),
Fix null pointer deref in docs with no root element (Hugh Davenport),
Fix XSD validation of URIs with ampersands (Alex Henrie),
xmlschemastypes.c: accept endOfDayFrag Times set to "24:00:00" mean "end of day" and should not cause an error. (Patrick Monnerat),
xmlcatalog: flush stdout before interactive shell input. (Patrick Monnerat),
xmllint: flush stdout before interactive shell input. (Patrick Monnerat),
Don't recurse into OP_VALUEs in xmlXPathOptimizeExpression (Nick Wellnhofer),
Fix namespace::node() XPath expression (Nick Wellnhofer),
Fix OOB write in xmlXPathEmptyNodeSet (Nick Wellnhofer),
Fix parsing of NCNames in XPath (Nick Wellnhofer),
Fix OOB read with invalid UTF-8 in xmlUTF8Strsize (Nick Wellnhofer),
Do normalize string-based datatype value in RelaxNG facet checking (Audric Schiltknecht),
Bug 760921: REGRESSION (8eb55d78): doc/examples/io1 test fails after fix for "xmlSaveUri() incorrectly recomposes URIs with rootless paths" <https://bugzilla.gnome.org/show_bug.cgi?id=760921> (David Kilzer),
Bug 760861: REGRESSION (bf9c1dad): Missing results for test/schemas/regexp-char-ref_[01].xsd <https://bugzilla.gnome.org/show_bug.cgi?id=760861> (David Kilzer),
error.c: *input->cur == 0 does not mean no error (Pavel Raiskup),
Add missing RNG test files (David Kilzer),
Bug 760183: REGRESSION (v2.9.3): XML push parser fails with bogus UTF-8 encoding error when multi-byte character in large CDATA section is split across buffer <https://bugzilla.gnome.org/show_bug.cgi?id=760183> (David Kilzer),
Bug 758572: ASAN crash in make check <https://bugzilla.gnome.org/show_bug.cgi?id=758572> (David Kilzer),
Bug 721158: Missing ICU string when doing --version on xmllint <https://bugzilla.gnome.org/show_bug.cgi?id=721158> (David Kilzer),
python 3: libxml2.c wrappers create Unicode str already (Michael Stahl),
Add autogen.sh to distrib (orzen),
Heap-based buffer overread in xmlNextChar (Daniel Veillard)
- Improvements:
Add more debugging info to runtest (Daniel Veillard),
Implement "runtest -u" mode (David Kilzer),
Add a make rule to rebuild for ASAN (Daniel Veillard)
v2.9.3: Nov 20 2015:
- Security:
CVE-2015-8242 Buffer overead with HTML parser in push mode (Hugh Davenport),
CVE-2015-7500 Fix memory access error due to incorrect entities boundaries (Daniel Veillard),
CVE-2015-7499-2 Detect incoherency on GROW (Daniel Veillard),
CVE-2015-7499-1 Add xmlHaltParser() to stop the parser (Daniel Veillard),
CVE-2015-5312 Another entity expansion issue (David Drysdale),
CVE-2015-7497 Avoid an heap buffer overflow in xmlDictComputeFastQKey (David Drysdale),
CVE-2015-7498 Avoid processing entities after encoding conversion failures (Daniel Veillard),
CVE-2015-8035 Fix XZ compression support loop (Daniel Veillard),
CVE-2015-7942-2 Fix an error in previous Conditional section patch (Daniel Veillard),
CVE-2015-7942 Another variation of overflow in Conditional sections (Daniel Veillard),
CVE-2015-1819 Enforce the reader to run in constant memory (Daniel Veillard)
CVE-2015-7941_2 Cleanup conditional section error handling (Daniel Veillard),
CVE-2015-7941_1 Stop parsing on entities boundaries errors (Daniel Veillard),
- Documentation:
Correct spelling of "calling" (Alex Henrie),
Fix a small error in xmllint --format description (Fabien Degomme),
Avoid XSS on the search of xmlsoft.org (Daniel Veillard)
- Portability:
threads: use forward declarations only for glibc (Michael Heimpold),
Update Win32 configure.js to search for configure.ac (Daniel Veillard)
- Bug Fixes:
Bug on creating new stream from entity (Daniel Veillard),
Fix some loop issues embedding NEXT (Daniel Veillard),
Do not print error context when there is none (Daniel Veillard),
Avoid extra processing of MarkupDecl when EOF (Hugh Davenport),
Fix parsing short unclosed comment uninitialized access (Daniel Veillard),
Add missing Null check in xmlParseExternalEntityPrivate (Gaurav Gupta),
Fix a bug in CData error handling in the push parser (Daniel Veillard),
Fix a bug on name parsing at the end of current input buffer (Daniel Veillard),
Fix the spurious ID already defined error (Daniel Veillard),
Fix previous change to node sort order (Nick Wellnhofer),
Fix a self assignment issue raised by clang (Scott Graham),
Fail parsing early on if encoding conversion failed (Daniel Veillard),
Do not process encoding values if the declaration if broken (Daniel Veillard),
Silence clang's -Wunknown-attribute (Michael Catanzaro),
xmlMemUsed is not thread-safe (Martin von Gagern),
Fix support for except in nameclasses (Daniel Veillard),
Fix order of root nodes (Nick Wellnhofer),
Allow attributes on descendant-or-self axis (Nick Wellnhofer),
Fix the fix to Windows locking (Steve Nairn),
Fix timsort invariant loop re: Envisage article (Christopher Swenson),
Don't add IDs in xmlSetTreeDoc (Nick Wellnhofer),
Account for ID attributes in xmlSetTreeDoc (Nick Wellnhofer),
Remove various unused value assignments (Philip Withnall),
Fix missing entities after CVE-2014-3660 fix (Daniel Veillard),
Revert "Missing initialization for the catalog module" (Daniel Veillard)
- Improvements:
Reuse xmlHaltParser() where it makes sense (Daniel Veillard),
xmlStopParser reset errNo (Daniel Veillard),
Reenable xz support by default (Daniel Veillard),
Recover unescaped less-than character in HTML recovery parsing (Daniel Veillard),
Allow HTML serializer to output HTML5 DOCTYPE (Shaun McCance),
Regression test for bug #695699 (Nick Wellnhofer),
Add a couple of XPath tests (Nick Wellnhofer),
Add Python 3 rpm subpackage (Tomas Radej),
libxml2-config.cmake.in: update include directories (Samuel Martin),
Adding example from bugs 738805 to regression tests (Daniel Veillard)
- Cleanups:
2.9.2: Oct 16 2014: 2.9.2: Oct 16 2014:
- Security: - Security:
Fix for CVE-2014-3660 billion laugh variant (Daniel Veillard), Fix for CVE-2014-3660 billion laugh variant (Daniel Veillard),
@ -845,7 +1288,7 @@ Gansterer),
- Improvement: switch parser to XML-1.0 5th edition, add parsing flags - Improvement: switch parser to XML-1.0 5th edition, add parsing flags
for old versions, switch URI parsing to RFC 3986, for old versions, switch URI parsing to RFC 3986,
add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer), add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer),
new hashing functions for dictionaries (based on Stefan Behnel work), new hashing functions for dictionnaries (based on Stefan Behnel work),
improve handling of misplaced html/head/body in HTML parser, better improve handling of misplaced html/head/body in HTML parser, better
regression test tools and code coverage display, better algorithms regression test tools and code coverage display, better algorithms
to detect various versions of the billion laughts attacks, make to detect various versions of the billion laughts attacks, make
@ -955,7 +1398,7 @@ Gansterer),
on Windows (Igor Zlatkovic), htmlCtxtReset fix (Michael Day), XPath on Windows (Igor Zlatkovic), htmlCtxtReset fix (Michael Day), XPath
principal node of axis bug, HTML serialization of some codepoint principal node of axis bug, HTML serialization of some codepoint
(Steven Rainwater), user data propagation in XInclude (Michael Day), (Steven Rainwater), user data propagation in XInclude (Michael Day),
standalone and XML decl detection (Michael Day), Python id ouptut standalone and XML decl detection (Michael Day), Python id output
for some id, fix the big python string memory leak, URI parsing fixes for some id, fix the big python string memory leak, URI parsing fixes
(Stéphane Bidoul and William), long comments parsing bug (William), (Stéphane Bidoul and William), long comments parsing bug (William),
concurrent threads initialization (Ted Phelps), invalid char concurrent threads initialization (Ted Phelps), invalid char
@ -967,7 +1410,7 @@ Gansterer),
min occurs of 0 (William), HTML script/style parsing (Mike Day) min occurs of 0 (William), HTML script/style parsing (Mike Day)
- Improvement: make xmlTextReaderSetup() public - Improvement: make xmlTextReaderSetup() public
- Compilation and postability: fix a missing include problem (William), - Compilation and postability: fix a missing include problem (William),
__ss_familly on AIX again (Björn Wiberg), compilation without zlib __ss_family on AIX again (Björn Wiberg), compilation without zlib
(Michael Day), catalog patch for Win32 (Christian Ehrlicher), (Michael Day), catalog patch for Win32 (Christian Ehrlicher),
Windows CE fixes (Andreas Stricke) Windows CE fixes (Andreas Stricke)
- Various CVS to SVN infrastructure changes - Various CVS to SVN infrastructure changes
@ -1006,7 +1449,7 @@ Gansterer),
fix attribute serialization in writer (Rob Richards), PHP4 DTD validation fix attribute serialization in writer (Rob Richards), PHP4 DTD validation
crasher, parser safety patch (Ben Darnell), _private context propagation crasher, parser safety patch (Ben Darnell), _private context propagation
when parsing entities (with Michael Day), fix entities behaviour when when parsing entities (with Michael Day), fix entities behaviour when
using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity using SAX, URI to file path fix (Mikhail Zabaluev), disappearing validity
context, arg error in SAX callback (Mike Hommey), fix mixed-content context, arg error in SAX callback (Mike Hommey), fix mixed-content
autodetect when using --noblanks, fix xmlIOParseDTD error handling, autodetect when using --noblanks, fix xmlIOParseDTD error handling,
fix bug in xmlSplitQName on special Names, fix Relax-NG element content fix bug in xmlSplitQName on special Names, fix Relax-NG element content
@ -1090,7 +1533,7 @@ Do not use or package 2.6.25
split problem (William), issues with non-namespaced attributes in split problem (William), issues with non-namespaced attributes in
xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards),
HTML parsing of script, Python must not output to stdout (Nic Ferrier), HTML parsing of script, Python must not output to stdout (Nic Ferrier),
exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype exclusive C14N namespace visibility (Aleksey Sanin), XSD datatype
totalDigits bug (Kasimier Buchcik), error handling when writing to an totalDigits bug (Kasimier Buchcik), error handling when writing to an
xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi
Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix
@ -1099,7 +1542,7 @@ Do not use or package 2.6.25
(Gary Coady), regexp bug affecting schemas (Kasimier), configuration of (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of
runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs
(Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair),
compilation and build fixes (Michael Day), removed dependancies on compilation and build fixes (Michael Day), removed dependencies on
xmlSchemaValidError (Kasimier), bug with <xml:foo/>, more XPath xmlSchemaValidError (Kasimier), bug with <xml:foo/>, more XPath
pattern based evaluation fixes (Kasimier) pattern based evaluation fixes (Kasimier)
- improvements: XSD Schemas redefinitions/restrictions (Kasimier - improvements: XSD Schemas redefinitions/restrictions (Kasimier
@ -1144,7 +1587,7 @@ Do not use or package 2.6.25
foreign namespaces handling, XML Schemas facet comparison (Kupriyanov foreign namespaces handling, XML Schemas facet comparison (Kupriyanov
Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml:
namespace ahndling in Schemas (Kasimier), empty model group in Schemas namespace ahndling in Schemas (Kasimier), empty model group in Schemas
(Kasimier), wilcard in Schemas (Kasimier), URI composition (William), (Kasimier), wildcard in Schemas (Kasimier), URI composition (William),
xs:anyType in Schemas (Kasimier), Python resolver emmitting error xs:anyType in Schemas (Kasimier), Python resolver emmitting error
messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to
fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob
@ -1231,7 +1674,7 @@ Do not use or package 2.6.25
Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed),
some gcc4 fixes, HP-UX portability fixes (Rick Jones). some gcc4 fixes, HP-UX portability fixes (Rick Jones).
- bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and - bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and
xmlreader stopping on non-fatal errors, thread support for dictionaries xmlreader stopping on non-fatal errors, thread support for dictionnaries
reference counting (Gary Coady), internal subset and push problem, URL reference counting (Gary Coady), internal subset and push problem, URL
saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths
fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix
@ -1318,7 +1761,7 @@ Do not use or package 2.6.25
Buchcik), XInclude testing, Notation serialization, UTF8ToISO8859x Buchcik), XInclude testing, Notation serialization, UTF8ToISO8859x
transcoding (Mark Itzcovitz), lots of XML Schemas cleanup and fixes transcoding (Mark Itzcovitz), lots of XML Schemas cleanup and fixes
(Kasimier), ChangeLog cleanup (Stepan Kasal), memory fixes (Mark Vakoc), (Kasimier), ChangeLog cleanup (Stepan Kasal), memory fixes (Mark Vakoc),
handling of failed realloc(), out of bound array adressing in Schemas handling of failed realloc(), out of bound array addressing in Schemas
date handling, Python space/tabs cleanups (Malcolm Tredinnick), NMTOKENS date handling, Python space/tabs cleanups (Malcolm Tredinnick), NMTOKENS
E20 validation fix (Malcolm), E20 validation fix (Malcolm),
- improvements: added W3C XML Schemas testsuite (Kasimier Buchcik), add - improvements: added W3C XML Schemas testsuite (Kasimier Buchcik), add
@ -1335,7 +1778,7 @@ Do not use or package 2.6.25
(Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack (Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack
and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace
problem (William), Schemas hexbinary empty values, encoding error could problem (William), Schemas hexbinary empty values, encoding error could
genrate a serialization loop. generate a serialization loop.
- Improvements: Schemas validity improvements (Kasimier), added --path - Improvements: Schemas validity improvements (Kasimier), added --path
and --load-trace options to xmllint and --load-trace options to xmllint
- documentation: tutorial update (John Fleck) - documentation: tutorial update (John Fleck)
@ -1482,7 +1925,7 @@ Do not use or package 2.6.25
William) reported by Yuuichi Teranishi William) reported by Yuuichi Teranishi
- bugfixes: make test and path issues, xmlWriter attribute serialization - bugfixes: make test and path issues, xmlWriter attribute serialization
(William Brack), xmlWriter indentation (William), schemas validation (William Brack), xmlWriter indentation (William), schemas validation
(Eric Haszlakiewicz), XInclude dictionaries issues (William and Oleg (Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg
Paraschenko), XInclude empty fallback (William), HTML warnings (William), Paraschenko), XInclude empty fallback (William), HTML warnings (William),
XPointer in XInclude (William), Python namespace serialization, XPointer in XInclude (William), Python namespace serialization,
isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter
@ -1493,7 +1936,7 @@ Do not use or package 2.6.25
--with-minimum configuration. --with-minimum configuration.
- XInclude: allow the 2001 namespace without warning. - XInclude: allow the 2001 namespace without warning.
- Documentation: missing example/index.html (John Fleck), version - Documentation: missing example/index.html (John Fleck), version
dependancies (John Fleck) dependencies (John Fleck)
- reader API: structured error reporting (Steve Ball) - reader API: structured error reporting (Steve Ball)
- Windows compilation: mingw, msys (Mikhail Grushinskiy), function - Windows compilation: mingw, msys (Mikhail Grushinskiy), function
prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_ prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_
@ -1503,7 +1946,7 @@ Do not use or package 2.6.25
2.6.5: Jan 25 2004: 2.6.5: Jan 25 2004:
- Bugfixes: dictionaries for schemas (William Brack), regexp segfault - Bugfixes: dictionnaries for schemas (William Brack), regexp segfault
(William), xs:all problem (William), a number of XPointer bugfixes (William), xs:all problem (William), a number of XPointer bugfixes
(William), xmllint error go to stderr, DTD validation problem with (William), xmllint error go to stderr, DTD validation problem with
namespace, memory leak (William), SAX1 cleanup and minimal options fixes namespace, memory leak (William), SAX1 cleanup and minimal options fixes
@ -1627,7 +2070,7 @@ Do not use or package 2.6.25
intercepted at a structured level, with precise information intercepted at a structured level, with precise information
available. available.
- New simpler and more generic XML and HTML parser APIs, allowing to - New simpler and more generic XML and HTML parser APIs, allowing to
easilly modify the parsing options and reuse parser context for multiple easily modify the parsing options and reuse parser context for multiple
consecutive documents. consecutive documents.
- Similar new APIs for the xmlReader, for options and reuse, provided new - Similar new APIs for the xmlReader, for options and reuse, provided new
functions to access content as const strings, use them for Python functions to access content as const strings, use them for Python

View file

@ -8,6 +8,7 @@ This code is released under the MIT Licence see the Copyright file.
To build on an Unixised setup: To build on an Unixised setup:
./configure ; make ; make install ./configure ; make ; make install
if the ./configure file does not exist, run ./autogen.sh instead.
To build on Windows: To build on Windows:
see instructions on win32/Readme.txt see instructions on win32/Readme.txt

View file

@ -40,7 +40,7 @@
* TODO: * TODO:
* *
* macro to flag unimplemented blocks * macro to flag unimplemented blocks
* XML_CATALOG_PREFER user env to select between system/public prefered * XML_CATALOG_PREFER user env to select between system/public preferred
* option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk> * option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk>
*> Just FYI, I am using an environment variable XML_CATALOG_PREFER with *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with
*> values "system" and "public". I have made the default be "system" to *> values "system" and "public". I have made the default be "system" to
@ -1512,8 +1512,8 @@ process_external_subset:
attr = elemDecl->attributes; attr = elemDecl->attributes;
while (attr != NULL) { while (attr != NULL) {
/* /*
* Make sure that attributes redefinition occuring in the * Make sure that attributes redefinition occurring in the
* internal subset are not overriden by definitions in the * internal subset are not overridden by definitions in the
* external subset. * external subset.
*/ */
if (attr->defaultValue != NULL) { if (attr->defaultValue != NULL) {
@ -1668,6 +1668,8 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
if (nodePush(ctxt, ret) < 0) { if (nodePush(ctxt, ret) < 0) {
xmlUnlinkNode(ret); xmlUnlinkNode(ret);
xmlFreeNode(ret); xmlFreeNode(ret);
if (prefix != NULL)
xmlFree(prefix);
return; return;
} }
@ -1734,8 +1736,8 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
} }
/* /*
* set the namespace node, making sure that if the default namspace * set the namespace node, making sure that if the default namespace
* is unbound on a parent we simply kee it NULL * is unbound on a parent we simply keep it NULL
*/ */
if ((ns != NULL) && (ns->href != NULL) && if ((ns != NULL) && (ns->href != NULL) &&
((ns->href[0] != 0) || (ns->prefix != NULL))) ((ns->href[0] != 0) || (ns->prefix != NULL)))
@ -2010,7 +2012,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
else else
ret->name = xmlStrdup(localname); ret->name = xmlStrdup(localname);
/* link at the end to preserv order, TODO speed up with a last */ /* link at the end to preserve order, TODO speed up with a last */
if (ctxt->node->properties == NULL) { if (ctxt->node->properties == NULL) {
ctxt->node->properties = ret; ctxt->node->properties = ret;
} else { } else {
@ -2102,7 +2104,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
} else { } else {
/* /*
* dup now contains a string of the flattened attribute * dup now contains a string of the flattened attribute
* content with entities substitued. Check if we need to * content with entities substituted. Check if we need to
* apply an extra layer of normalization. * apply an extra layer of normalization.
* It need to be done twice ... it's an extra burden related * It need to be done twice ... it's an extra burden related
* to the ability to keep references in attributes * to the ability to keep references in attributes
@ -2135,7 +2137,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
} }
} else { } else {
/* /*
* if entities already have been substitued, then * if entities already have been substituted, then
* the attribute as passed is already normalized * the attribute as passed is already normalized
*/ */
dup = xmlStrndup(value, valueend - value); dup = xmlStrndup(value, valueend - value);
@ -2398,7 +2400,7 @@ xmlSAX2StartElementNs(void *ctx,
if (nb_attributes > 0) { if (nb_attributes > 0) {
for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
/* /*
* Handle the rare case of an undefined atribute prefix * Handle the rare case of an undefined attribute prefix
*/ */
if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
if (ctxt->dictNames) { if (ctxt->dictNames) {
@ -2584,7 +2586,7 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
* The whole point of maintaining nodelen and nodemem, * The whole point of maintaining nodelen and nodemem,
* xmlTextConcat is too costly, i.e. compute length, * xmlTextConcat is too costly, i.e. compute length,
* reallocate a new buffer, move data, append ch. Here * reallocate a new buffer, move data, append ch. Here
* We try to minimaze realloc() uses and avoid copying * We try to minimize realloc() uses and avoid copying
* and recomputing length over and over. * and recomputing length over and over.
*/ */
if (lastChild->content == (xmlChar *)&(lastChild->properties)) { if (lastChild->content == (xmlChar *)&(lastChild->properties)) {

View file

@ -1,7 +1,7 @@
/* /*
* buf.c: memory buffers for libxml2 * buf.c: memory buffers for libxml2
* *
* new buffer structures and entry points to simplify the maintainance * new buffer structures and entry points to simplify the maintenance
* of libxml2 and ensure we keep good control over memory allocations * of libxml2 and ensure we keep good control over memory allocations
* and stay 64 bits clean. * and stay 64 bits clean.
* The new entry point use the xmlBufPtr opaque structure and * The new entry point use the xmlBufPtr opaque structure and
@ -396,7 +396,7 @@ xmlBufShrink(xmlBufPtr buf, size_t len) {
((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) { ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) {
/* /*
* we just move the content pointer, but also make sure * we just move the content pointer, but also make sure
* the perceived buffer size has shrinked accordingly * the perceived buffer size has shrunk accordingly
*/ */
buf->content += len; buf->content += len;
buf->size -= len; buf->size -= len;
@ -958,7 +958,7 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
if (start_buf > (unsigned int) len) { if (start_buf > (unsigned int) len) {
/* /*
* We can add it in the space previously shrinked * We can add it in the space previously shrunk
*/ */
buf->content -= len; buf->content -= len;
memmove(&buf->content[0], str, len); memmove(&buf->content[0], str, len);
@ -1204,10 +1204,10 @@ xmlBufferPtr
xmlBufBackToBuffer(xmlBufPtr buf) { xmlBufBackToBuffer(xmlBufPtr buf) {
xmlBufferPtr ret; xmlBufferPtr ret;
if ((buf == NULL) || (buf->error)) if (buf == NULL)
return(NULL); return(NULL);
CHECK_COMPAT(buf) CHECK_COMPAT(buf)
if (buf->buffer == NULL) { if ((buf->error) || (buf->buffer == NULL)) {
xmlBufFree(buf); xmlBufFree(buf);
return(NULL); return(NULL);
} }
@ -1307,7 +1307,7 @@ xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input) {
CHECK_COMPAT(buf) CHECK_COMPAT(buf)
base = input->base - buf->content; base = input->base - buf->content;
/* /*
* We could do some pointer arythmetic checks but that's probably * We could do some pointer arithmetic checks but that's probably
* sufficient. * sufficient.
*/ */
if (base > buf->size) { if (base > buf->size) {

View file

@ -43,7 +43,7 @@ typedef enum {
typedef struct _xmlC14NVisibleNsStack { typedef struct _xmlC14NVisibleNsStack {
int nsCurEnd; /* number of nodes in the set */ int nsCurEnd; /* number of nodes in the set */
int nsPrevStart; /* the begginning of the stack for previous visible node */ int nsPrevStart; /* the beginning of the stack for previous visible node */
int nsPrevEnd; /* the end of the stack for previous visible node */ int nsPrevEnd; /* the end of the stack for previous visible node */
int nsMax; /* size of the array as allocated */ int nsMax; /* size of the array as allocated */
xmlNsPtr *nsTab; /* array of ns in no particular order */ xmlNsPtr *nsTab; /* array of ns in no particular order */
@ -226,7 +226,7 @@ xmlC14NErrRelativeNamespace(const char *ns_uri)
* xmlC14NErr: * xmlC14NErr:
* @ctxt: a C14N evaluation context * @ctxt: a C14N evaluation context
* @node: the context node * @node: the context node
* @error: the erorr code * @error: the error code
* @msg: the message * @msg: the message
* @extra: extra informations * @extra: extra informations
* *
@ -1827,7 +1827,7 @@ xmlC14NNewCtx(xmlDocPtr doc,
} }
/* /*
* Set "mode" flag and remember list of incluseve prefixes * Set "mode" flag and remember list of inclusive prefixes
* for exclusive c14n * for exclusive c14n
*/ */
ctx->mode = mode; ctx->mode = mode;
@ -2039,7 +2039,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
(void) xmlOutputBufferClose(buf); (void) xmlOutputBufferClose(buf);
if ((*doc_txt_ptr == NULL) && (ret > 0)) { if ((*doc_txt_ptr == NULL) && (ret > 0)) {
xmlC14NErrMemory("coping canonicanized document"); xmlC14NErrMemory("coping canonicalized document");
return (-1); return (-1);
} }
return (ret); return (ret);
@ -2057,7 +2057,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
* canonicalization, ignored otherwise) * canonicalization, ignored otherwise)
* @with_comments: include comments in the result (!=0) or not (==0) * @with_comments: include comments in the result (!=0) or not (==0)
* @filename: the filename to store canonical XML image * @filename: the filename to store canonical XML image
* @compression: the compression level (zlib requred): * @compression: the compression level (zlib required):
* -1 - libxml default, * -1 - libxml default,
* 0 - uncompressed, * 0 - uncompressed,
* >0 - compression level * >0 - compression level
@ -2100,7 +2100,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes,
with_comments, buf); with_comments, buf);
if (ret < 0) { if (ret < 0) {
xmlC14NErrInternal("cannicanize document to buffer"); xmlC14NErrInternal("canonize document to buffer");
(void) xmlOutputBufferClose(buf); (void) xmlOutputBufferClose(buf);
return (-1); return (-1);
} }

View file

@ -56,7 +56,7 @@
* TODO: * TODO:
* *
* macro to flag unimplemented blocks * macro to flag unimplemented blocks
* XML_CATALOG_PREFER user env to select between system/public prefered * XML_CATALOG_PREFER user env to select between system/public preferred
* option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk> * option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk>
*> Just FYI, I am using an environment variable XML_CATALOG_PREFER with *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with
*> values "system" and "public". I have made the default be "system" to *> values "system" and "public". I have made the default be "system" to

View file

@ -289,7 +289,7 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) {
dict = doc->dict; dict = doc->dict;
if ((dict == NULL) && (ctxt->nodict == 0)) { if ((dict == NULL) && (ctxt->nodict == 0)) {
#if 0 #if 0
/* desactivated right now as it raises too many errors */ /* deactivated right now as it raises too many errors */
if (doc->type == XML_DOCUMENT_NODE) if (doc->type == XML_DOCUMENT_NODE)
xmlDebugErr(ctxt, XML_CHECK_NO_DICT, xmlDebugErr(ctxt, XML_CHECK_NO_DICT,
"Document has no dictionary\n"); "Document has no dictionary\n");
@ -1168,7 +1168,7 @@ xmlCtxtDumpDocHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
* @output: the FILE * for the output * @output: the FILE * for the output
* @doc: the document * @doc: the document
* *
* Dumps debug information cncerning the document, not recursive * Dumps debug information concerning the document, not recursive
*/ */
static void static void
xmlCtxtDumpDocumentHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) xmlCtxtDumpDocumentHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
@ -1498,7 +1498,7 @@ xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth)
* @output: the FILE * for the output * @output: the FILE * for the output
* @doc: the document * @doc: the document
* *
* Dumps debug information cncerning the document, not recursive * Dumps debug information concerning the document, not recursive
*/ */
void void
xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc) xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc)
@ -2363,10 +2363,7 @@ xmlShellRNGValidate(xmlShellCtxtPtr sctxt, char *schemas,
int ret; int ret;
ctxt = xmlRelaxNGNewParserCtxt(schemas); ctxt = xmlRelaxNGNewParserCtxt(schemas);
xmlRelaxNGSetParserErrors(ctxt, xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
(xmlRelaxNGValidityErrorFunc) fprintf,
(xmlRelaxNGValidityWarningFunc) fprintf,
stderr);
relaxngschemas = xmlRelaxNGParse(ctxt); relaxngschemas = xmlRelaxNGParse(ctxt);
xmlRelaxNGFreeParserCtxt(ctxt); xmlRelaxNGFreeParserCtxt(ctxt);
if (relaxngschemas == NULL) { if (relaxngschemas == NULL) {
@ -2375,10 +2372,7 @@ xmlShellRNGValidate(xmlShellCtxtPtr sctxt, char *schemas,
return(-1); return(-1);
} }
vctxt = xmlRelaxNGNewValidCtxt(relaxngschemas); vctxt = xmlRelaxNGNewValidCtxt(relaxngschemas);
xmlRelaxNGSetValidErrors(vctxt, xmlRelaxNGSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL);
(xmlRelaxNGValidityErrorFunc) fprintf,
(xmlRelaxNGValidityWarningFunc) fprintf,
stderr);
ret = xmlRelaxNGValidateDoc(vctxt, sctxt->doc); ret = xmlRelaxNGValidateDoc(vctxt, sctxt->doc);
if (ret == 0) { if (ret == 0) {
fprintf(stderr, "%s validates\n", sctxt->filename); fprintf(stderr, "%s validates\n", sctxt->filename);
@ -2647,9 +2641,9 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
int res = -1; int res = -1;
if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1); if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1);
vctxt.userData = stderr; vctxt.userData = NULL;
vctxt.error = (xmlValidityErrorFunc) fprintf; vctxt.error = xmlGenericError;
vctxt.warning = (xmlValidityWarningFunc) fprintf; vctxt.warning = xmlGenericError;
if ((dtd == NULL) || (dtd[0] == 0)) { if ((dtd == NULL) || (dtd[0] == 0)) {
res = xmlValidateDocument(&vctxt, ctxt->doc); res = xmlValidateDocument(&vctxt, ctxt->doc);

View file

@ -38,7 +38,8 @@
* list we will use the BigKey algo as soon as the hash size grows * list we will use the BigKey algo as soon as the hash size grows
* over MIN_DICT_SIZE so this actually works * over MIN_DICT_SIZE so this actually works
*/ */
#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \
!defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
#define DICT_RANDOMIZATION #define DICT_RANDOMIZATION
#endif #endif
@ -371,6 +372,9 @@ found_pool:
* http://burtleburtle.net/bob/hash/doobs.html * http://burtleburtle.net/bob/hash/doobs.html
*/ */
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
#endif
static uint32_t static uint32_t
xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) { xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
uint32_t hash; uint32_t hash;
@ -403,6 +407,9 @@ xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
* *
* Neither of the two strings must be NULL. * Neither of the two strings must be NULL.
*/ */
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
#endif
static unsigned long static unsigned long
xmlDictComputeBigQKey(const xmlChar *prefix, int plen, xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
const xmlChar *name, int len, int seed) const xmlChar *name, int len, int seed)
@ -727,7 +734,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
dict->dict[key].next = entry; dict->dict[key].next = entry;
} else { } else {
/* /*
* we don't have much ways to alert from herei * we don't have much ways to alert from here
* result is losing an entry and unicity guarantee * result is losing an entry and unicity guarantee
*/ */
ret = -1; ret = -1;
@ -1202,7 +1209,7 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
* @dict: the dictionary * @dict: the dictionary
* @str: the string * @str: the string
* *
* check if a string is owned by the disctionary * check if a string is owned by the dictionary
* *
* Returns 1 if true, 0 if false and -1 in case of error * Returns 1 if true, 0 if false and -1 in case of error
* -1 in case of error * -1 in case of error

View file

@ -4311,6 +4311,16 @@ extern __typeof (xmlHashCreateDict) xmlHashCreateDict__internal_alias __attribut
#endif #endif
#endif #endif
#ifdef bottom_hash
#undef xmlHashDefaultDeallocator
extern __typeof (xmlHashDefaultDeallocator) xmlHashDefaultDeallocator __attribute((alias("xmlHashDefaultDeallocator__internal_alias")));
#else
#ifndef xmlHashDefaultDeallocator
extern __typeof (xmlHashDefaultDeallocator) xmlHashDefaultDeallocator__internal_alias __attribute((visibility("hidden")));
#define xmlHashDefaultDeallocator xmlHashDefaultDeallocator__internal_alias
#endif
#endif
#ifdef bottom_hash #ifdef bottom_hash
#undef xmlHashFree #undef xmlHashFree
extern __typeof (xmlHashFree) xmlHashFree __attribute((alias("xmlHashFree__internal_alias"))); extern __typeof (xmlHashFree) xmlHashFree __attribute((alias("xmlHashFree__internal_alias")));

View file

@ -1,7 +1,7 @@
/* /*
* Summary: Internal Interfaces for encoding in libxml2 * Summary: Internal Interfaces for encoding in libxml2
* Description: this module describes a few interfaces which were * Description: this module describes a few interfaces which were
* addded along with the API changes in 2.9.0 * added along with the API changes in 2.9.0
* those are private routines at this point * those are private routines at this point
* *
* Copy: See Copyright for the status of this software. * Copy: See Copyright for the status of this software.

View file

@ -1795,7 +1795,7 @@ xmlFindCharEncodingHandler(const char *name) {
* *
* The value of @inlen after return is the number of octets consumed * The value of @inlen after return is the number of octets consumed
* as the return value is positive, else unpredictable. * as the return value is positive, else unpredictable.
* The value of @outlen after return is the number of ocetes consumed. * The value of @outlen after return is the number of octets consumed.
*/ */
static int static int
xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
@ -1863,7 +1863,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
* *
* The value of @inlen after return is the number of octets consumed * The value of @inlen after return is the number of octets consumed
* as the return value is positive, else unpredictable. * as the return value is positive, else unpredictable.
* The value of @outlen after return is the number of ocetes consumed. * The value of @outlen after return is the number of octets consumed.
*/ */
static int static int
xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
@ -1972,7 +1972,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
/** /**
* xmlCharEncFirstLineInt: * xmlCharEncFirstLineInt:
* @handler: char enconding transformation data structure * @handler: char encoding transformation data structure
* @out: an xmlBuffer for the output. * @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input * @in: an xmlBuffer for the input
* @len: number of bytes to convert for the first line, or -1 * @len: number of bytes to convert for the first line, or -1
@ -2059,7 +2059,7 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
/** /**
* xmlCharEncFirstLine: * xmlCharEncFirstLine:
* @handler: char enconding transformation data structure * @handler: char encoding transformation data structure
* @out: an xmlBuffer for the output. * @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input * @in: an xmlBuffer for the input
* *
@ -2546,7 +2546,7 @@ retry:
/** /**
* xmlCharEncOutFunc: * xmlCharEncOutFunc:
* @handler: char enconding transformation data structure * @handler: char encoding transformation data structure
* @out: an xmlBuffer for the output. * @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input * @in: an xmlBuffer for the input
* *
@ -2710,7 +2710,7 @@ retry:
/** /**
* xmlCharEncCloseFunc: * xmlCharEncCloseFunc:
* @handler: char enconding transformation data structure * @handler: char encoding transformation data structure
* *
* Generic front-end for encoding handler close function * Generic front-end for encoding handler close function
* *
@ -2811,7 +2811,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
xmlCharEncodingHandler * handler = in->buf->encoder; xmlCharEncodingHandler * handler = in->buf->encoder;
/* /*
* Encoding conversion, compute the number of unused original * Encoding conversion, compute the number of unused original
* bytes from the input not consumed and substract that from * bytes from the input not consumed and subtract that from
* the raw consumed value, this is not a cheap operation * the raw consumed value, this is not a cheap operation
*/ */
if (in->end - in->cur > 0) { if (in->end - in->cur > 0) {
@ -2860,7 +2860,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
* Returns 0 if success, -2 if the transcoding fails, or -1 otherwise * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
* The value of @inlen after return is the number of octets consumed * The value of @inlen after return is the number of octets consumed
* as the return value is positive, else unpredictable. * as the return value is positive, else unpredictable.
* The value of @outlen after return is the number of ocetes consumed. * The value of @outlen after return is the number of octets consumed.
*/ */
static int static int
UTF8ToISO8859x(unsigned char* out, int *outlen, UTF8ToISO8859x(unsigned char* out, int *outlen,
@ -2976,7 +2976,7 @@ UTF8ToISO8859x(unsigned char* out, int *outlen,
* block of chars out. * block of chars out.
* Returns 0 if success, or -1 otherwise * Returns 0 if success, or -1 otherwise
* The value of @inlen after return is the number of octets consumed * The value of @inlen after return is the number of octets consumed
* The value of @outlen after return is the number of ocetes produced. * The value of @outlen after return is the number of octets produced.
*/ */
static int static int
ISO8859xToUTF8(unsigned char* out, int *outlen, ISO8859xToUTF8(unsigned char* out, int *outlen,

View file

@ -148,7 +148,7 @@ xmlFreeEntity(xmlEntityPtr entity)
/* /*
* xmlCreateEntity: * xmlCreateEntity:
* *
* internal routine doing the entity node strutures allocations * internal routine doing the entity node structures allocations
*/ */
static xmlEntityPtr static xmlEntityPtr
xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type, xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type,
@ -398,7 +398,7 @@ xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type,
* *
* Create a new entity, this differs from xmlAddDocEntity() that if * Create a new entity, this differs from xmlAddDocEntity() that if
* the document is NULL or has no internal subset defined, then an * the document is NULL or has no internal subset defined, then an
* unlinked entity structure will be returned, it is then the responsability * unlinked entity structure will be returned, it is then the responsibility
* of the caller to link it to the document later or free it when not needed * of the caller to link it to the document later or free it when not needed
* anymore. * anymore.
* *
@ -548,7 +548,7 @@ xmlGetDocEntity(const xmlDoc *doc, const xmlChar *name) {
* xmlEncodeEntitiesInternal: * xmlEncodeEntitiesInternal:
* @doc: the document containing the string * @doc: the document containing the string
* @input: A string to convert to XML. * @input: A string to convert to XML.
* @attr: are we handling an atrbute value * @attr: are we handling an attribute value
* *
* Do a global encoding of a string, replacing the predefined entities * Do a global encoding of a string, replacing the predefined entities
* and non ASCII values with their entities and CharRef counterparts. * and non ASCII values with their entities and CharRef counterparts.

View file

@ -238,7 +238,7 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
* @ctx: the parser context or NULL * @ctx: the parser context or NULL
* @str: the formatted error message * @str: the formatted error message
* *
* Report an erro with its context, replace the 4 old error/warning * Report an error with its context, replace the 4 old error/warning
* routines. * routines.
*/ */
static void static void
@ -631,7 +631,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
(channel == xmlParserValidityError) || (channel == xmlParserValidityError) ||
(channel == xmlParserValidityWarning)) (channel == xmlParserValidityWarning))
xmlReportError(to, ctxt, str, NULL, NULL); xmlReportError(to, ctxt, str, NULL, NULL);
else if ((channel == (xmlGenericErrorFunc) fprintf) || else if (((void(*)(void)) channel == (void(*)(void)) fprintf) ||
(channel == xmlGenericErrorDefaultFunc)) (channel == xmlGenericErrorDefaultFunc))
xmlReportError(to, ctxt, str, channel, data); xmlReportError(to, ctxt, str, channel, data);
else else

View file

@ -107,7 +107,7 @@ xmlMallocFunc xmlMalloc = malloc;
* @size: the size requested in bytes * @size: the size requested in bytes
* *
* The variable holding the libxml malloc() implementation for atomic * The variable holding the libxml malloc() implementation for atomic
* data (i.e. blocks not containings pointers), useful when using a * data (i.e. blocks not containing pointers), useful when using a
* garbage collecting allocator. * garbage collecting allocator.
* *
* Returns a pointer to the newly allocated block or NULL in case of error * Returns a pointer to the newly allocated block or NULL in case of error
@ -260,7 +260,7 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
* Global setting, indicate that the parser should store the line number * Global setting, indicate that the parser should store the line number
* in the content field of elements in the DOM tree. * in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of * Disabled by default since this may not be safe for old classes of
* applicaton. * application.
*/ */
int xmlLineNumbersDefaultValue = 0; int xmlLineNumbersDefaultValue = 0;
static int xmlLineNumbersDefaultValueThrDef = 0; static int xmlLineNumbersDefaultValueThrDef = 0;
@ -361,7 +361,7 @@ static const char *xmlTreeIndentStringThrDef = " ";
* xmlSaveNoEmptyTags: * xmlSaveNoEmptyTags:
* *
* Global setting, asking the serializer to not output empty tags * Global setting, asking the serializer to not output empty tags
* as <empty/> but <empty></empty>. those two forms are undistinguishable * as <empty/> but <empty></empty>. those two forms are indistinguishable
* once parsed. * once parsed.
* Disabled by default * Disabled by default
*/ */

View file

@ -33,7 +33,8 @@
* it seems that having hash randomization might be a good idea * it seems that having hash randomization might be a good idea
* when using XML with untrusted data * when using XML with untrusted data
*/ */
#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \
!defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
#define HASH_RANDOMIZATION #define HASH_RANDOMIZATION
#endif #endif
@ -78,6 +79,9 @@ struct _xmlHashTable {
* xmlHashComputeKey: * xmlHashComputeKey:
* Calculate the hash key * Calculate the hash key
*/ */
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
#endif
static unsigned long static unsigned long
xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3) { const xmlChar *name2, const xmlChar *name3) {
@ -108,6 +112,9 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
return (value % table->size); return (value % table->size);
} }
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
#endif
static unsigned long static unsigned long
xmlHashComputeQKey(xmlHashTablePtr table, xmlHashComputeQKey(xmlHashTablePtr table,
const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix, const xmlChar *name,

View file

@ -38,7 +38,7 @@
#if defined(_MSC_VER) || defined(__BORLANDC__) #if defined(_MSC_VER) || defined(__BORLANDC__)
/* MS C-runtime has functions which can be used in order to determine if /* MS C-runtime has functions which can be used in order to determine if
a given floating-point variable contains NaN, (+-)INF. These are a given floating-point variable contains NaN, (+-)INF. These are
preferred, because floating-point technology is considered propriatary preferred, because floating-point technology is considered proprietary
by MS and we can assume that their functions know more about their by MS and we can assume that their functions know more about their
oddities than we do. */ oddities than we do. */
#include <float.h> #include <float.h>

View file

@ -11,6 +11,11 @@
#include <errno.h> #include <errno.h>
#include <winsock2.h> #include <winsock2.h>
/* Fix for old MinGW. */
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif
/* the following is a workaround a problem for 'inline' keyword in said /* the following is a workaround a problem for 'inline' keyword in said
header when compiled with Borland C++ 6 */ header when compiled with Borland C++ 6 */
#if defined(__BORLANDC__) && !defined(__cplusplus) #if defined(__BORLANDC__) && !defined(__cplusplus)

View file

@ -34,7 +34,7 @@
/* /*
* Currently supported platforms use either autoconf or * Currently supported platforms use either autoconf or
* copy to config.h own "preset" configuration file. * copy to config.h own "preset" configuration file.
* As result ifdef HAVE_CONFIG_H is omited here. * As result ifdef HAVE_CONFIG_H is omitted here.
*/ */
#include "config.h" #include "config.h"
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
@ -53,7 +53,7 @@ int vfprintf(FILE *, const char *, va_list);
/** /**
* TRIO_REPLACE_STDIO: * TRIO_REPLACE_STDIO:
* *
* This macro is defined if teh trio string formatting functions are to * This macro is defined if the trio string formatting functions are to
* be used instead of the default stdio ones. * be used instead of the default stdio ones.
*/ */
#define TRIO_REPLACE_STDIO #define TRIO_REPLACE_STDIO
@ -72,6 +72,13 @@ int vfprintf(FILE *, const char *, va_list);
#define XML_POP_WARNINGS #define XML_POP_WARNINGS
#endif #endif
#if defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 8))
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
#else
#define ATTRIBUTE_NO_SANITIZE(arg)
#endif
/* /*
* Internal variable indicating if a callback has been registered for * Internal variable indicating if a callback has been registered for
* node creation/destruction. It avoids spending a lot of time in locking * node creation/destruction. It avoids spending a lot of time in locking
@ -79,7 +86,7 @@ int vfprintf(FILE *, const char *, va_list);
*/ */
extern int __xmlRegisterCallbacks; extern int __xmlRegisterCallbacks;
/* /*
* internal error reporting routines, shared but not partof the API. * internal error reporting routines, shared but not part of the API.
*/ */
void __xmlIOErr(int domain, int code, const char *extra); void __xmlIOErr(int domain, int code, const char *extra);
void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0); void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0);

View file

@ -1143,12 +1143,12 @@ xmlNanoHTTPConnectHost(const char *host, int port)
switch (h_errno) { switch (h_errno) {
case HOST_NOT_FOUND: case HOST_NOT_FOUND:
h_err_txt = "Authoritive host not found"; h_err_txt = "Authoritative host not found";
break; break;
case TRY_AGAIN: case TRY_AGAIN:
h_err_txt = h_err_txt =
"Non-authoritive host not found or server failure."; "Non-authoritative host not found or server failure.";
break; break;
case NO_RECOVERY: case NO_RECOVERY:

View file

@ -96,6 +96,12 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
static void xmlHaltParser(xmlParserCtxtPtr ctxt); static void xmlHaltParser(xmlParserCtxtPtr ctxt);
static int
xmlParseElementStart(xmlParserCtxtPtr ctxt);
static void
xmlParseElementEnd(xmlParserCtxtPtr ctxt);
/************************************************************************ /************************************************************************
* * * *
* Arbitrary limits set in the parser. See XML_PARSE_HUGE * * Arbitrary limits set in the parser. See XML_PARSE_HUGE *
@ -108,7 +114,7 @@ static void xmlHaltParser(xmlParserCtxtPtr ctxt);
/* /*
* XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity * XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity
* replacement over the size in byte of the input indicates that you have * replacement over the size in byte of the input indicates that you have
* and eponential behaviour. A value of 10 correspond to at least 3 entity * and exponential behaviour. A value of 10 correspond to at least 3 entity
* replacement per byte of input. * replacement per byte of input.
*/ */
#define XML_PARSER_NON_LINEAR 10 #define XML_PARSER_NON_LINEAR 10
@ -140,7 +146,7 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
(ent->content != NULL) && (ent->checked == 0) && (ent->content != NULL) && (ent->checked == 0) &&
(ctxt->errNo != XML_ERR_ENTITY_LOOP)) { (ctxt->errNo != XML_ERR_ENTITY_LOOP)) {
unsigned long oldnbent = ctxt->nbentities; unsigned long oldnbent = ctxt->nbentities, diff;
xmlChar *rep; xmlChar *rep;
ent->checked = 1; ent->checked = 1;
@ -153,7 +159,10 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
ent->content[0] = 0; ent->content[0] = 0;
} }
ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; diff = ctxt->nbentities - oldnbent + 1;
if (diff > INT_MAX / 2)
diff = INT_MAX / 2;
ent->checked = diff * 2;
if (rep != NULL) { if (rep != NULL) {
if (xmlStrchr(rep, '<')) if (xmlStrchr(rep, '<'))
ent->checked |= 1; ent->checked |= 1;
@ -1060,7 +1069,7 @@ xmlHasFeature(xmlFeature feature)
* xmlDetectSAX2: * xmlDetectSAX2:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* *
* Do the SAX2 detection and specific intialization * Do the SAX2 detection and specific initialization
*/ */
static void static void
xmlDetectSAX2(xmlParserCtxtPtr ctxt) { xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
@ -1392,7 +1401,7 @@ xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
* [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
* [38] Subcode ::= ([a-z] | [A-Z])+ * [38] Subcode ::= ([a-z] | [A-Z])+
* *
* The current REC reference the sucessors of RFC 1766, currently 5646 * The current REC reference the successors of RFC 1766, currently 5646
* *
* http://www.rfc-editor.org/rfc/rfc5646.txt * http://www.rfc-editor.org/rfc/rfc5646.txt
* langtag = language * langtag = language
@ -1819,7 +1828,6 @@ nodePop(xmlParserCtxtPtr ctxt)
return (ret); return (ret);
} }
#ifdef LIBXML_PUSH_ENABLED
/** /**
* nameNsPush: * nameNsPush:
* @ctxt: an XML parser context * @ctxt: an XML parser context
@ -1855,6 +1863,11 @@ nameNsPush(xmlParserCtxtPtr ctxt, const xmlChar * value,
goto mem_error; goto mem_error;
} }
ctxt->pushTab = tmp2; ctxt->pushTab = tmp2;
} else if (ctxt->pushTab == NULL) {
ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 *
sizeof(ctxt->pushTab[0]));
if (ctxt->pushTab == NULL)
goto mem_error;
} }
ctxt->nameTab[ctxt->nameNr] = value; ctxt->nameTab[ctxt->nameNr] = value;
ctxt->name = value; ctxt->name = value;
@ -1866,6 +1879,7 @@ mem_error:
xmlErrMemory(ctxt, NULL); xmlErrMemory(ctxt, NULL);
return (-1); return (-1);
} }
#ifdef LIBXML_PUSH_ENABLED
/** /**
* nameNsPop: * nameNsPop:
* @ctxt: an XML parser context * @ctxt: an XML parser context
@ -2075,11 +2089,11 @@ static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
xmlGROW (ctxt); xmlGROW (ctxt);
static void xmlGROW (xmlParserCtxtPtr ctxt) { static void xmlGROW (xmlParserCtxtPtr ctxt) {
unsigned long curEnd = ctxt->input->end - ctxt->input->cur; ptrdiff_t curEnd = ctxt->input->end - ctxt->input->cur;
unsigned long curBase = ctxt->input->cur - ctxt->input->base; ptrdiff_t curBase = ctxt->input->cur - ctxt->input->base;
if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) || if (((curEnd > XML_MAX_LOOKUP_LIMIT) ||
(curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) && (curBase > XML_MAX_LOOKUP_LIMIT)) &&
((ctxt->input->buf) && ((ctxt->input->buf) &&
(ctxt->input->buf->readcallback != xmlInputReadCallbackNop)) && (ctxt->input->buf->readcallback != xmlInputReadCallbackNop)) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) { ((ctxt->options & XML_PARSE_HUGE) == 0)) {
@ -2281,9 +2295,8 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
*/ */
int int
xmlParseCharRef(xmlParserCtxtPtr ctxt) { xmlParseCharRef(xmlParserCtxtPtr ctxt) {
unsigned int val = 0; int val = 0;
int count = 0; int count = 0;
unsigned int outofrange = 0;
/* /*
* Using RAW/CUR/NEXT is okay since we are working on ASCII range here * Using RAW/CUR/NEXT is okay since we are working on ASCII range here
@ -2310,8 +2323,8 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
val = 0; val = 0;
break; break;
} }
if (val > 0x10FFFF) if (val > 0x110000)
outofrange = val; val = 0x110000;
NEXT; NEXT;
count++; count++;
@ -2339,8 +2352,8 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
val = 0; val = 0;
break; break;
} }
if (val > 0x10FFFF) if (val > 0x110000)
outofrange = val; val = 0x110000;
NEXT; NEXT;
count++; count++;
@ -2360,7 +2373,11 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
* Characters referred to using character references must match the * Characters referred to using character references must match the
* production for Char. * production for Char.
*/ */
if ((IS_CHAR(val) && (outofrange == 0))) { if (val >= 0x110000) {
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
"xmlParseCharRef: character reference out of bounds\n",
val);
} else if (IS_CHAR(val)) {
return(val); return(val);
} else { } else {
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
@ -2392,8 +2409,7 @@ static int
xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
const xmlChar *ptr; const xmlChar *ptr;
xmlChar cur; xmlChar cur;
unsigned int val = 0; int val = 0;
unsigned int outofrange = 0;
if ((str == NULL) || (*str == NULL)) return(0); if ((str == NULL) || (*str == NULL)) return(0);
ptr = *str; ptr = *str;
@ -2413,8 +2429,8 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
val = 0; val = 0;
break; break;
} }
if (val > 0x10FFFF) if (val > 0x110000)
outofrange = val; val = 0x110000;
ptr++; ptr++;
cur = *ptr; cur = *ptr;
@ -2432,8 +2448,8 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
val = 0; val = 0;
break; break;
} }
if (val > 0x10FFFF) if (val > 0x110000)
outofrange = val; val = 0x110000;
ptr++; ptr++;
cur = *ptr; cur = *ptr;
@ -2451,7 +2467,11 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
* Characters referred to using character references must match the * Characters referred to using character references must match the
* production for Char. * production for Char.
*/ */
if ((IS_CHAR(val) && (outofrange == 0))) { if (val >= 0x110000) {
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
"xmlParseStringCharRef: character reference out of bounds\n",
val);
} else if (IS_CHAR(val)) {
return(val); return(val);
} else { } else {
xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
@ -2702,7 +2722,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
/* /*
* Note: external parsed entities will not be loaded, * Note: external parsed entities will not be loaded,
* it is not required for a non-validating parser to * it is not required for a non-validating parser to
* complete external PEreferences coming from the * complete external PEReferences coming from the
* internal subset * internal subset
*/ */
if (((ctxt->options & XML_PARSE_NOENT) != 0) || if (((ctxt->options & XML_PARSE_NOENT) != 0) ||
@ -3366,7 +3386,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
/* /*
* when shrinking to extend the buffer we really need to preserve * when shrinking to extend the buffer we really need to preserve
* the part of the name we already parsed. Hence rolling back * the part of the name we already parsed. Hence rolling back
* by current lenght. * by current length.
*/ */
ctxt->input->cur -= l; ctxt->input->cur -= l;
GROW; GROW;
@ -3835,7 +3855,7 @@ error:
* xmlParseAttValueComplex: * xmlParseAttValueComplex:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* @len: the resulting attribute len * @len: the resulting attribute len
* @normalize: wether to apply the inner normalization * @normalize: whether to apply the inner normalization
* *
* parse a value for an attribute, this is the fallback function * parse a value for an attribute, this is the fallback function
* of xmlParseAttValue() when the attribute parsing requires handling * of xmlParseAttValue() when the attribute parsing requires handling
@ -3984,14 +4004,17 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
*/ */
if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
(ent->content != NULL) && (ent->checked == 0)) { (ent->content != NULL) && (ent->checked == 0)) {
unsigned long oldnbent = ctxt->nbentities; unsigned long oldnbent = ctxt->nbentities, diff;
++ctxt->depth; ++ctxt->depth;
rep = xmlStringDecodeEntities(ctxt, ent->content, rep = xmlStringDecodeEntities(ctxt, ent->content,
XML_SUBSTITUTE_REF, 0, 0, 0); XML_SUBSTITUTE_REF, 0, 0, 0);
--ctxt->depth; --ctxt->depth;
ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; diff = ctxt->nbentities - oldnbent + 1;
if (diff > INT_MAX / 2)
diff = INT_MAX / 2;
ent->checked = diff * 2;
if (rep != NULL) { if (rep != NULL) {
if (xmlStrchr(rep, '<')) if (xmlStrchr(rep, '<'))
ent->checked |= 1; ent->checked |= 1;
@ -4059,7 +4082,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
/* /*
* There we potentially risk an overflow, don't allow attribute value of * There we potentially risk an overflow, don't allow attribute value of
* length more than INT_MAX it is a very reasonnable assumption ! * length more than INT_MAX it is a very reasonable assumption !
*/ */
if (len >= INT_MAX) { if (len >= INT_MAX) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
@ -4664,7 +4687,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
* xmlParseCommentComplex: * xmlParseCommentComplex:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* @buf: the already parsed part of the buffer * @buf: the already parsed part of the buffer
* @len: number of bytes filles in the buffer * @len: number of bytes in the buffer
* @size: allocated size of the buffer * @size: allocated size of the buffer
* *
* Skip an XML (SGML) comment <!-- .... --> * Skip an XML (SGML) comment <!-- .... -->
@ -4955,6 +4978,10 @@ get_more:
} else } else
xmlFatalErrMsgStr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, xmlFatalErrMsgStr(ctxt, XML_ERR_HYPHEN_IN_COMMENT,
"Double hyphen within comment\n", NULL); "Double hyphen within comment\n", NULL);
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(buf);
return;
}
in++; in++;
ctxt->input->col++; ctxt->input->col++;
} }
@ -5085,7 +5112,7 @@ error:
* *
* [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' * [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
* *
* The processing is transfered to SAX once parsed. * The processing is transferred to SAX once parsed.
*/ */
void void
@ -5501,7 +5528,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
literal, URI, NULL); literal, URI, NULL);
/* /*
* For expat compatibility in SAX mode. * For expat compatibility in SAX mode.
* assuming the entity repalcement was asked for * assuming the entity replacement was asked for
*/ */
if ((ctxt->replaceEntities != 0) && if ((ctxt->replaceEntities != 0) &&
((ctxt->myDoc == NULL) || ((ctxt->myDoc == NULL) ||
@ -6611,149 +6638,143 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
static void static void
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
int id = ctxt->input->id; int *inputIds = NULL;
size_t inputIdsSize = 0;
size_t depth = 0;
SKIP(3); while (ctxt->instate != XML_PARSER_EOF) {
SKIP_BLANKS; if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) { int id = ctxt->input->id;
SKIP(7);
SKIP_BLANKS; SKIP(3);
if (RAW != '[') { SKIP_BLANKS;
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
xmlHaltParser(ctxt); if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
return; SKIP(7);
} else { SKIP_BLANKS;
if (ctxt->input->id != id) { if (RAW != '[') {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
"All markup of the conditional section is not" xmlHaltParser(ctxt);
goto error;
}
if (ctxt->input->id != id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is"
" not in the same entity\n");
}
NEXT;
if (inputIdsSize <= depth) {
int *tmp;
inputIdsSize = (inputIdsSize == 0 ? 4 : inputIdsSize * 2);
tmp = (int *) xmlRealloc(inputIds,
inputIdsSize * sizeof(int));
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
goto error;
}
inputIds = tmp;
}
inputIds[depth] = id;
depth++;
} else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) {
int state;
xmlParserInputState instate;
size_t ignoreDepth = 0;
SKIP(6);
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
xmlHaltParser(ctxt);
goto error;
}
if (ctxt->input->id != id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is"
" not in the same entity\n");
}
NEXT;
/*
* Parse up to the end of the conditional section but disable
* SAX event generating DTD building in the meantime
*/
state = ctxt->disableSAX;
instate = ctxt->instate;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
ctxt->instate = XML_PARSER_IGNORE;
while (RAW != 0) {
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
SKIP(3);
ignoreDepth++;
/* Check for integer overflow */
if (ignoreDepth == 0) {
xmlErrMemory(ctxt, NULL);
goto error;
}
} else if ((RAW == ']') && (NXT(1) == ']') &&
(NXT(2) == '>')) {
if (ignoreDepth == 0)
break;
SKIP(3);
ignoreDepth--;
} else {
NEXT;
}
}
ctxt->disableSAX = state;
ctxt->instate = instate;
if (RAW == 0) {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
goto error;
}
if (ctxt->input->id != id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is"
" not in the same entity\n");
}
SKIP(3);
} else {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
xmlHaltParser(ctxt);
goto error;
}
} else if ((depth > 0) &&
(RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
depth--;
if (ctxt->input->id != inputIds[depth]) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not"
" in the same entity\n"); " in the same entity\n");
} }
NEXT; SKIP(3);
} } else {
if (xmlParserDebugEntities) { const xmlChar *check = CUR_PTR;
if ((ctxt->input != NULL) && (ctxt->input->filename)) unsigned int cons = ctxt->input->consumed;
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename, xmlParseMarkupDecl(ctxt);
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext, if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
"Entering INCLUDE Conditional Section\n"); xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
} xmlHaltParser(ctxt);
goto error;
}
}
if (depth == 0)
break;
SKIP_BLANKS; SKIP_BLANKS;
GROW; GROW;
while (((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') ||
(NXT(2) != '>'))) && (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *check = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
} else
xmlParseMarkupDecl(ctxt);
SKIP_BLANKS;
GROW;
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
xmlHaltParser(ctxt);
break;
}
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Leaving INCLUDE Conditional Section\n");
}
} else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) {
int state;
xmlParserInputState instate;
int depth = 0;
SKIP(6);
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
xmlHaltParser(ctxt);
return;
} else {
if (ctxt->input->id != id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not"
" in the same entity\n");
}
NEXT;
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Entering IGNORE Conditional Section\n");
}
/*
* Parse up to the end of the conditional section
* But disable SAX event generating DTD building in the meantime
*/
state = ctxt->disableSAX;
instate = ctxt->instate;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
ctxt->instate = XML_PARSER_IGNORE;
while (((depth >= 0) && (RAW != 0)) &&
(ctxt->instate != XML_PARSER_EOF)) {
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
depth++;
SKIP(3);
continue;
}
if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
if (--depth >= 0) SKIP(3);
continue;
}
NEXT;
continue;
}
ctxt->disableSAX = state;
ctxt->instate = instate;
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Leaving IGNORE Conditional Section\n");
}
} else {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
xmlHaltParser(ctxt);
return;
} }
if (RAW == 0) error:
SHRINK; xmlFree(inputIds);
if (RAW == 0) {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
} else {
if (ctxt->input->id != id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in"
" the same entity\n");
}
if ((ctxt-> instate != XML_PARSER_EOF) &&
((ctxt->input->cur + 3) <= ctxt->input->end))
SKIP(3);
}
} }
/** /**
@ -6810,21 +6831,11 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
/* /*
* detect requirement to exit there and act accordingly * detect requirement to exit there and act accordingly
* and avoid having instate overriden later on * and avoid having instate overridden later on
*/ */
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
return; return;
/*
* Conditional sections are allowed from entities included
* by PE References in the internal subset.
*/
if ((ctxt->external == 0) && (ctxt->inputNr > 1)) {
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
}
}
ctxt->instate = XML_PARSER_DTD; ctxt->instate = XML_PARSER_DTD;
} }
@ -7009,7 +7020,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
*/ */
if (NXT(1) == '#') { if (NXT(1) == '#') {
int i = 0; int i = 0;
xmlChar out[10]; xmlChar out[16];
int hex = NXT(2); int hex = NXT(2);
int value = xmlParseCharRef(ctxt); int value = xmlParseCharRef(ctxt);
@ -7086,7 +7097,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) && ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) || ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
(ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) { (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
unsigned long oldnbent = ctxt->nbentities; unsigned long oldnbent = ctxt->nbentities, diff;
/* /*
* This is a bit hackish but this seems the best * This is a bit hackish but this seems the best
@ -7127,7 +7138,10 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
* Store the number of entities needing parsing for this entity * Store the number of entities needing parsing for this entity
* content and do checkings * content and do checkings
*/ */
ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; diff = ctxt->nbentities - oldnbent + 1;
if (diff > INT_MAX / 2)
diff = INT_MAX / 2;
ent->checked = diff * 2;
if ((ent->content != NULL) && (xmlStrchr(ent->content, '<'))) if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
ent->checked |= 1; ent->checked |= 1;
if (ret == XML_ERR_ENTITY_LOOP) { if (ret == XML_ERR_ENTITY_LOOP) {
@ -7675,7 +7689,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
} }
/* /*
* Increate the number of entity references parsed * Increase the number of entity references parsed
*/ */
ctxt->nbentities++; ctxt->nbentities++;
@ -7851,7 +7865,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
NEXT; NEXT;
/* /*
* Increate the number of entity references parsed * Increase the number of entity references parsed
*/ */
ctxt->nbentities++; ctxt->nbentities++;
@ -8117,7 +8131,7 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
ptr++; ptr++;
/* /*
* Increate the number of entity references parsed * Increase the number of entity references parsed
*/ */
ctxt->nbentities++; ctxt->nbentities++;
@ -8285,6 +8299,15 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
xmlParseMarkupDecl(ctxt); xmlParseMarkupDecl(ctxt);
xmlParsePEReference(ctxt); xmlParsePEReference(ctxt);
/*
* Conditional sections are allowed from external entities included
* by PE References in the internal subset.
*/
if ((ctxt->inputNr > 1) && (ctxt->input->filename != NULL) &&
(RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
}
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"xmlParseInternalSubset: error detected in Markup declaration\n"); "xmlParseInternalSubset: error detected in Markup declaration\n");
@ -8713,12 +8736,16 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) {
if (l == NULL) { if (l == NULL) {
xmlChar *tmp; xmlChar *tmp;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
xmlNsErr(ctxt, XML_NS_ERR_QNAME, xmlNsErr(ctxt, XML_NS_ERR_QNAME,
"Failed to parse QName '%s:'\n", p, NULL, NULL); "Failed to parse QName '%s:'\n", p, NULL, NULL);
l = xmlParseNmtoken(ctxt); l = xmlParseNmtoken(ctxt);
if (l == NULL) if (l == NULL) {
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
tmp = xmlBuildQName(BAD_CAST "", p, NULL, 0); tmp = xmlBuildQName(BAD_CAST "", p, NULL, 0);
else { } else {
tmp = xmlBuildQName(l, p, NULL, 0); tmp = xmlBuildQName(l, p, NULL, 0);
xmlFree((char *)l); xmlFree((char *)l);
} }
@ -8741,6 +8768,8 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) {
*prefix = p; *prefix = p;
return(l); return(l);
} }
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
tmp = xmlBuildQName(BAD_CAST "", l, NULL, 0); tmp = xmlBuildQName(BAD_CAST "", l, NULL, 0);
l = xmlDictLookup(ctxt->dict, tmp, -1); l = xmlDictLookup(ctxt->dict, tmp, -1);
if (tmp != NULL) xmlFree(tmp); if (tmp != NULL) xmlFree(tmp);
@ -8840,6 +8869,18 @@ xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name,
* caller if it was copied, this can be detected by val[*len] == 0. * caller if it was copied, this can be detected by val[*len] == 0.
*/ */
#define GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) \
const xmlChar *oldbase = ctxt->input->base;\
GROW;\
if (ctxt->instate == XML_PARSER_EOF)\
return(NULL);\
if (oldbase != ctxt->input->base) {\
ptrdiff_t delta = ctxt->input->base - oldbase;\
start = start + delta;\
in = in + delta;\
}\
end = ctxt->input->end;
static xmlChar * static xmlChar *
xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
int normalize) int normalize)
@ -8869,14 +8910,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
end = ctxt->input->end; end = ctxt->input->end;
start = in; start = in;
if (in >= end) { if (in >= end) {
const xmlChar *oldbase = ctxt->input->base; GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
GROW;
if (oldbase != ctxt->input->base) {
long delta = ctxt->input->base - oldbase;
start = start + delta;
in = in + delta;
}
end = ctxt->input->end;
} }
if (normalize) { if (normalize) {
/* /*
@ -8893,16 +8927,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
in++; in++;
start = in; start = in;
if (in >= end) { if (in >= end) {
const xmlChar *oldbase = ctxt->input->base; GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
GROW;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
if (oldbase != ctxt->input->base) {
long delta = ctxt->input->base - oldbase;
start = start + delta;
in = in + delta;
}
end = ctxt->input->end;
if (((in - start) > XML_MAX_TEXT_LENGTH) && if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) { ((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
@ -8916,16 +8941,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
col++; col++;
if ((*in++ == 0x20) && (*in == 0x20)) break; if ((*in++ == 0x20) && (*in == 0x20)) break;
if (in >= end) { if (in >= end) {
const xmlChar *oldbase = ctxt->input->base; GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
GROW;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
if (oldbase != ctxt->input->base) {
long delta = ctxt->input->base - oldbase;
start = start + delta;
in = in + delta;
}
end = ctxt->input->end;
if (((in - start) > XML_MAX_TEXT_LENGTH) && if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) { ((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
@ -8954,7 +8970,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
return(NULL); return(NULL);
if (oldbase != ctxt->input->base) { if (oldbase != ctxt->input->base) {
long delta = ctxt->input->base - oldbase; ptrdiff_t delta = ctxt->input->base - oldbase;
start = start + delta; start = start + delta;
in = in + delta; in = in + delta;
last = last + delta; last = last + delta;
@ -8981,16 +8997,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
in++; in++;
col++; col++;
if (in >= end) { if (in >= end) {
const xmlChar *oldbase = ctxt->input->base; GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
GROW;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
if (oldbase != ctxt->input->base) {
long delta = ctxt->input->base - oldbase;
start = start + delta;
in = in + delta;
}
end = ctxt->input->end;
if (((in - start) > XML_MAX_TEXT_LENGTH) && if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) { ((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
@ -9084,7 +9091,7 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
if (normalize) { if (normalize) {
/* /*
* Sometimes a second normalisation pass for spaces is needed * Sometimes a second normalisation pass for spaces is needed
* but that only happens if charrefs or entities refernces * but that only happens if charrefs or entities references
* have been used in the attribute value, i.e. the attribute * have been used in the attribute value, i.e. the attribute
* value have been extracted in an allocated string already. * value have been extracted in an allocated string already.
*/ */
@ -9247,7 +9254,8 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
xmlErrMemory(ctxt, "dictionary allocation failure"); xmlErrMemory(ctxt, "dictionary allocation failure");
if ((attvalue != NULL) && (alloc != 0)) if ((attvalue != NULL) && (alloc != 0))
xmlFree(attvalue); xmlFree(attvalue);
return(NULL); localname = NULL;
goto done;
} }
if (*URL != 0) { if (*URL != 0) {
uri = xmlParseURI((const char *) URL); uri = xmlParseURI((const char *) URL);
@ -9497,7 +9505,8 @@ next_attr:
if ((atts == NULL) || (nbatts + 5 > maxatts)) { if ((atts == NULL) || (nbatts + 5 > maxatts)) {
if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) { if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
return(NULL); localname = NULL;
goto done;
} }
maxatts = ctxt->maxatts; maxatts = ctxt->maxatts;
atts = ctxt->atts; atts = ctxt->atts;
@ -9807,9 +9816,10 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
void void
xmlParseContent(xmlParserCtxtPtr ctxt) { xmlParseContent(xmlParserCtxtPtr ctxt) {
int nameNr = ctxt->nameNr;
GROW; GROW;
while ((RAW != 0) && while ((RAW != 0) &&
((RAW != '<') || (NXT(1) != '/')) &&
(ctxt->instate != XML_PARSER_EOF)) { (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *test = CUR_PTR; const xmlChar *test = CUR_PTR;
unsigned int cons = ctxt->input->consumed; unsigned int cons = ctxt->input->consumed;
@ -9843,7 +9853,13 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
* Fourth case : a sub-element. * Fourth case : a sub-element.
*/ */
else if (*cur == '<') { else if (*cur == '<') {
xmlParseElement(ctxt); if (NXT(1) == '/') {
if (ctxt->nameNr <= nameNr)
break;
xmlParseElementEnd(ctxt);
} else {
xmlParseElementStart(ctxt);
}
} }
/* /*
@ -9878,7 +9894,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
* xmlParseElement: * xmlParseElement:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* *
* parse an XML element, this is highly recursive * parse an XML element
* *
* [39] element ::= EmptyElemTag | STag content ETag * [39] element ::= EmptyElemTag | STag content ETag
* *
@ -9890,6 +9906,23 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
void void
xmlParseElement(xmlParserCtxtPtr ctxt) { xmlParseElement(xmlParserCtxtPtr ctxt) {
if (xmlParseElementStart(ctxt) != 0)
return;
xmlParseContent(ctxt);
if (ctxt->instate == XML_PARSER_EOF)
return;
xmlParseElementEnd(ctxt);
}
/**
* xmlParseElementStart:
* @ctxt: an XML parser context
*
* Parse the start of an XML element. Returns -1 in case of error, 0 if an
* opening tag was parsed, 1 if an empty element was parsed.
*/
static int
xmlParseElementStart(xmlParserCtxtPtr ctxt) {
const xmlChar *name; const xmlChar *name;
const xmlChar *prefix = NULL; const xmlChar *prefix = NULL;
const xmlChar *URI = NULL; const xmlChar *URI = NULL;
@ -9904,7 +9937,7 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
"Excessive depth in document: %d use XML_PARSE_HUGE option\n", "Excessive depth in document: %d use XML_PARSE_HUGE option\n",
xmlParserMaxDepth); xmlParserMaxDepth);
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
return; return(-1);
} }
/* Capture start position */ /* Capture start position */
@ -9931,12 +9964,17 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
name = xmlParseStartTag(ctxt); name = xmlParseStartTag(ctxt);
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
return; return(-1);
if (name == NULL) { if (name == NULL) {
spacePop(ctxt); spacePop(ctxt);
return; return(-1);
} }
namePush(ctxt, name); if (ctxt->sax2)
nameNsPush(ctxt, name, prefix, URI, ctxt->nsNr - nsNr);
#ifdef LIBXML_SAX1_ENABLED
else
namePush(ctxt, name);
#endif /* LIBXML_SAX1_ENABLED */
ret = ctxt->node; ret = ctxt->node;
#ifdef LIBXML_VALID_ENABLED #ifdef LIBXML_VALID_ENABLED
@ -9977,7 +10015,7 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
node_info.node = ret; node_info.node = ret;
xmlParserAddNodeInfo(ctxt, &node_info); xmlParserAddNodeInfo(ctxt, &node_info);
} }
return; return(1);
} }
if (RAW == '>') { if (RAW == '>') {
NEXT1; NEXT1;
@ -10005,41 +10043,39 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
node_info.node = ret; node_info.node = ret;
xmlParserAddNodeInfo(ctxt, &node_info); xmlParserAddNodeInfo(ctxt, &node_info);
} }
return; return(-1);
} }
/* return(0);
* Parse the content of the element: }
*/
xmlParseContent(ctxt);
if (ctxt->instate == XML_PARSER_EOF)
return;
if (!IS_BYTE_CHAR(RAW)) {
xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NOT_FINISHED,
"Premature end of data in tag %s line %d\n",
name, line, NULL);
/* /**
* end of parsing of this node. * xmlParseElementEnd:
*/ * @ctxt: an XML parser context
nodePop(ctxt); *
namePop(ctxt); * Parse the end of an XML element.
spacePop(ctxt); */
if (nsNr != ctxt->nsNr) static void
nsPop(ctxt, ctxt->nsNr - nsNr); xmlParseElementEnd(xmlParserCtxtPtr ctxt) {
return; xmlParserNodeInfo node_info;
} xmlNodePtr ret = ctxt->node;
if (ctxt->nameNr <= 0)
return;
/* /*
* parse the end of tag: '</' should be here. * parse the end of tag: '</' should be here.
*/ */
if (ctxt->sax2) { if (ctxt->sax2) {
xmlParseEndTag2(ctxt, prefix, URI, line, ctxt->nsNr - nsNr, tlen); const xmlChar *prefix = ctxt->pushTab[ctxt->nameNr * 3 - 3];
const xmlChar *URI = ctxt->pushTab[ctxt->nameNr * 3 - 2];
int nsNr = (ptrdiff_t) ctxt->pushTab[ctxt->nameNr * 3 - 1];
xmlParseEndTag2(ctxt, prefix, URI, 0, nsNr, 0);
namePop(ctxt); namePop(ctxt);
} }
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
else else
xmlParseEndTag1(ctxt, line); xmlParseEndTag1(ctxt, 0);
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
/* /*
@ -10281,7 +10317,7 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
} }
/* /*
* UTF-16 encoding stwich has already taken place at this stage, * UTF-16 encoding switch has already taken place at this stage,
* more over the little-endian/big-endian selection is already done * more over the little-endian/big-endian selection is already done
*/ */
if ((encoding != NULL) && if ((encoding != NULL) &&
@ -11164,7 +11200,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
else { else {
/* /*
* If we are operating on converted input, try to flush * If we are operating on converted input, try to flush
* remainng chars to avoid them stalling in the non-converted * remaining chars to avoid them stalling in the non-converted
* buffer. But do not do this in document start where * buffer. But do not do this in document start where
* encoding="..." may not have been read and we work on a * encoding="..." may not have been read and we work on a
* guessed encoding. * guessed encoding.
@ -12356,13 +12392,6 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
return(NULL); return(NULL);
} }
ctxt->dictNames = 1; ctxt->dictNames = 1;
ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 * sizeof(xmlChar *));
if (ctxt->pushTab == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFreeParserInputBuffer(buf);
xmlFreeParserCtxt(ctxt);
return(NULL);
}
if (sax != NULL) { if (sax != NULL) {
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
@ -13898,7 +13927,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
xmlFreeParserCtxt(ctxt); xmlFreeParserCtxt(ctxt);
newDoc->intSubset = NULL; newDoc->intSubset = NULL;
newDoc->extSubset = NULL; newDoc->extSubset = NULL;
newDoc->oldNs = NULL; if(doc != NULL)
newDoc->oldNs = NULL;
xmlFreeDoc(newDoc); xmlFreeDoc(newDoc);
return(ret); return(ret);
@ -14007,6 +14037,10 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
ctxt->input_id = pctx->input_id + 1; ctxt->input_id = pctx->input_id + 1;
} }
/* Don't read from stdin. */
if (xmlStrcmp(URL, BAD_CAST "-") == 0)
URL = BAD_CAST "./-";
uri = xmlBuildURI(URL, base); uri = xmlBuildURI(URL, base);
if (uri == NULL) { if (uri == NULL) {
@ -14939,16 +14973,6 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
xmlCtxtReset(ctxt); xmlCtxtReset(ctxt);
if (ctxt->pushTab == NULL) {
ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 *
sizeof(xmlChar *));
if (ctxt->pushTab == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFreeParserInputBuffer(buf);
return(1);
}
}
if (filename == NULL) { if (filename == NULL) {
ctxt->directory = NULL; ctxt->directory = NULL;
} else { } else {

View file

@ -703,7 +703,7 @@ encoding_error:
/* /*
* An encoding problem may arise from a truncated input buffer * An encoding problem may arise from a truncated input buffer
* splitting a character in the middle. In that case do not raise * splitting a character in the middle. In that case do not raise
* an error but return 0 to endicate an end of stream problem * an error but return 0 to indicate an end of stream problem
*/ */
if (ctxt->input->end - ctxt->input->cur < 4) { if (ctxt->input->end - ctxt->input->cur < 4) {
*len = 0; *len = 0;
@ -816,7 +816,7 @@ encoding_error:
/* /*
* An encoding problem may arise from a truncated input buffer * An encoding problem may arise from a truncated input buffer
* splitting a character in the middle. In that case do not raise * splitting a character in the middle. In that case do not raise
* an error but return 0 to endicate an end of stream problem * an error but return 0 to indicate an end of stream problem
*/ */
if ((ctxt == NULL) || (ctxt->input == NULL) || if ((ctxt == NULL) || (ctxt->input == NULL) ||
(ctxt->input->end - ctxt->input->cur < 4)) { (ctxt->input->end - ctxt->input->cur < 4)) {
@ -1093,7 +1093,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
} }
} }
/* /*
* TODO: We could recover from errors in external entites if we * TODO: We could recover from errors in external entities if we
* didn't stop the parser. But most callers of this function don't * didn't stop the parser. But most callers of this function don't
* check the return value. * check the return value.
*/ */
@ -1138,7 +1138,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
if (input->buf != NULL) { if (input->buf != NULL) {
if (input->buf->encoder != NULL) { if (input->buf->encoder != NULL) {
/* /*
* Check in case the auto encoding detetection triggered * Check in case the auto encoding detection triggered
* in already. * in already.
*/ */
if (input->buf->encoder == handler) if (input->buf->encoder == handler)

View file

@ -1,5 +1,5 @@
/* /*
* pattern.c: Implemetation of selectors for nodes * pattern.c: Implementation of selectors for nodes
* *
* Reference: * Reference:
* http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/ * http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/
@ -55,7 +55,7 @@
/* /*
* NOTE: Those private flags (XML_STREAM_xxx) are used * NOTE: Those private flags (XML_STREAM_xxx) are used
* in _xmlStreamCtxt->flag. They extend the public * in _xmlStreamCtxt->flag. They extend the public
* xmlPatternFlags, so be carefull not to interfere with the * xmlPatternFlags, so be careful not to interfere with the
* reserved values for xmlPatternFlags. * reserved values for xmlPatternFlags.
*/ */
#define XML_STREAM_FINAL_IS_ANY_NODE 1<<14 #define XML_STREAM_FINAL_IS_ANY_NODE 1<<14
@ -229,13 +229,16 @@ xmlNewPattern(void) {
*/ */
void void
xmlFreePattern(xmlPatternPtr comp) { xmlFreePattern(xmlPatternPtr comp) {
xmlFreePatternList(comp);
}
static void
xmlFreePatternInternal(xmlPatternPtr comp) {
xmlStepOpPtr op; xmlStepOpPtr op;
int i; int i;
if (comp == NULL) if (comp == NULL)
return; return;
if (comp->next != NULL)
xmlFreePattern(comp->next);
if (comp->stream != NULL) if (comp->stream != NULL)
xmlFreeStreamComp(comp->stream); xmlFreeStreamComp(comp->stream);
if (comp->pattern != NULL) if (comp->pattern != NULL)
@ -273,7 +276,7 @@ xmlFreePatternList(xmlPatternPtr comp) {
cur = comp; cur = comp;
comp = comp->next; comp = comp->next;
cur->next = NULL; cur->next = NULL;
xmlFreePattern(cur); xmlFreePatternInternal(cur);
} }
} }
@ -742,7 +745,7 @@ rollback:
* xmlPatScanLiteral: * xmlPatScanLiteral:
* @ctxt: the XPath Parser context * @ctxt: the XPath Parser context
* *
* Parse an XPath Litteral: * Parse an XPath Literal:
* *
* [29] Literal ::= '"' [^"]* '"' * [29] Literal ::= '"' [^"]* '"'
* | "'" [^']* "'" * | "'" [^']* "'"
@ -1973,7 +1976,7 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
} else { } else {
/* /*
* If there are "//", then we need to process every "//" * If there are "//", then we need to process every "//"
* occuring in the states, plus any other state for this * occurring in the states, plus any other state for this
* level. * level.
*/ */
stepNr = stream->states[2 * i]; stepNr = stream->states[2 * i];

View file

@ -125,11 +125,11 @@ typedef enum {
XML_RELAXNG_EXCEPT, /* except present in nameclass defs */ XML_RELAXNG_EXCEPT, /* except present in nameclass defs */
XML_RELAXNG_TEXT, /* textual content */ XML_RELAXNG_TEXT, /* textual content */
XML_RELAXNG_ELEMENT, /* an element */ XML_RELAXNG_ELEMENT, /* an element */
XML_RELAXNG_DATATYPE, /* extenal data type definition */ XML_RELAXNG_DATATYPE, /* external data type definition */
XML_RELAXNG_PARAM, /* extenal data type parameter */ XML_RELAXNG_PARAM, /* external data type parameter */
XML_RELAXNG_VALUE, /* value from an extenal data type definition */ XML_RELAXNG_VALUE, /* value from an external data type definition */
XML_RELAXNG_LIST, /* a list of patterns */ XML_RELAXNG_LIST, /* a list of patterns */
XML_RELAXNG_ATTRIBUTE, /* an attrbute following a pattern */ XML_RELAXNG_ATTRIBUTE, /* an attribute following a pattern */
XML_RELAXNG_DEF, /* a definition */ XML_RELAXNG_DEF, /* a definition */
XML_RELAXNG_REF, /* reference to a definition */ XML_RELAXNG_REF, /* reference to a definition */
XML_RELAXNG_EXTERNALREF, /* reference to an external def */ XML_RELAXNG_EXTERNALREF, /* reference to an external def */
@ -228,7 +228,7 @@ struct _xmlRelaxNGParserCtxt {
xmlDocPtr document; xmlDocPtr document;
int defNr; /* number of defines used */ int defNr; /* number of defines used */
int defMax; /* number of defines aloocated */ int defMax; /* number of defines allocated */
xmlRelaxNGDefinePtr *defTab; /* pointer to the allocated definitions */ xmlRelaxNGDefinePtr *defTab; /* pointer to the allocated definitions */
const char *buffer; const char *buffer;
@ -1128,7 +1128,7 @@ xmlRelaxNGAddStates(xmlRelaxNGValidCtxtPtr ctxt,
/** /**
* xmlRelaxNGFreeStates: * xmlRelaxNGFreeStates:
* @ctxt: a Relax-NG validation context * @ctxt: a Relax-NG validation context
* @states: teh container * @states: the container
* *
* Free a RelaxNG validation state container * Free a RelaxNG validation state container
*/ */
@ -1340,7 +1340,7 @@ xmlRelaxNGCopyValidState(xmlRelaxNGValidCtxtPtr ctxt,
* *
* Compare the validation states for equality * Compare the validation states for equality
* *
* Returns 1 if equald, 0 otherwise * Returns 1 if equal, 0 otherwise
*/ */
static int static int
xmlRelaxNGEqualValidState(xmlRelaxNGValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlRelaxNGEqualValidState(xmlRelaxNGValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
@ -2815,7 +2815,7 @@ xmlRelaxNGRegisterTypeLibrary(const xmlChar * namespace, void *data,
/** /**
* xmlRelaxNGInitTypes: * xmlRelaxNGInitTypes:
* *
* Initilize the default type libraries. * Initialize the default type libraries.
* *
* Returns 0 in case of success and -1 in case of error. * Returns 0 in case of success and -1 in case of error.
*/ */
@ -2878,7 +2878,7 @@ static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGDefinePtr def); xmlRelaxNGDefinePtr def);
/** /**
* xmlRelaxNGIsCompileable: * xmlRelaxNGIsCompilable:
* @define: the definition to check * @define: the definition to check
* *
* Check if a definition is nullable. * Check if a definition is nullable.
@ -2886,7 +2886,7 @@ static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
* Returns 1 if yes, 0 if no and -1 in case of error * Returns 1 if yes, 0 if no and -1 in case of error
*/ */
static int static int
xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def) xmlRelaxNGIsCompilable(xmlRelaxNGDefinePtr def)
{ {
int ret = -1; int ret = -1;
@ -2901,7 +2901,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
return (0); return (0);
switch (def->type) { switch (def->type) {
case XML_RELAXNG_NOOP: case XML_RELAXNG_NOOP:
ret = xmlRelaxNGIsCompileable(def->content); ret = xmlRelaxNGIsCompilable(def->content);
break; break;
case XML_RELAXNG_TEXT: case XML_RELAXNG_TEXT:
case XML_RELAXNG_EMPTY: case XML_RELAXNG_EMPTY:
@ -2909,7 +2909,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
break; break;
case XML_RELAXNG_ELEMENT: case XML_RELAXNG_ELEMENT:
/* /*
* Check if the element content is compileable * Check if the element content is compilable
*/ */
if (((def->dflags & IS_NOT_COMPILABLE) == 0) && if (((def->dflags & IS_NOT_COMPILABLE) == 0) &&
((def->dflags & IS_COMPILABLE) == 0)) { ((def->dflags & IS_COMPILABLE) == 0)) {
@ -2917,7 +2917,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
list = def->content; list = def->content;
while (list != NULL) { while (list != NULL) {
ret = xmlRelaxNGIsCompileable(list); ret = xmlRelaxNGIsCompilable(list);
if (ret != 1) if (ret != 1)
break; break;
list = list->next; list = list->next;
@ -2943,13 +2943,13 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
def->name); def->name);
} else { } else {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Problem in RelaxNGIsCompileable for element %s\n", "Problem in RelaxNGIsCompilable for element %s\n",
def->name); def->name);
} }
#endif #endif
} }
/* /*
* All elements return a compileable status unless they * All elements return a compilable status unless they
* are generic like anyName * are generic like anyName
*/ */
if ((def->nameClass != NULL) || (def->name == NULL)) if ((def->nameClass != NULL) || (def->name == NULL))
@ -2968,7 +2968,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
def->depth = -20; def->depth = -20;
list = def->content; list = def->content;
while (list != NULL) { while (list != NULL) {
ret = xmlRelaxNGIsCompileable(list); ret = xmlRelaxNGIsCompilable(list);
if (ret != 1) if (ret != 1)
break; break;
list = list->next; list = list->next;
@ -2986,7 +2986,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
list = def->content; list = def->content;
while (list != NULL) { while (list != NULL) {
ret = xmlRelaxNGIsCompileable(list); ret = xmlRelaxNGIsCompilable(list);
if (ret != 1) if (ret != 1)
break; break;
list = list->next; list = list->next;
@ -3011,15 +3011,15 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
#ifdef DEBUG_COMPILE #ifdef DEBUG_COMPILE
if (ret == 1) { if (ret == 1) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"RelaxNGIsCompileable %s : true\n", "RelaxNGIsCompilable %s : true\n",
xmlRelaxNGDefName(def)); xmlRelaxNGDefName(def));
} else if (ret == 0) { } else if (ret == 0) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"RelaxNGIsCompileable %s : false\n", "RelaxNGIsCompilable %s : false\n",
xmlRelaxNGDefName(def)); xmlRelaxNGDefName(def));
} else { } else {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Problem in RelaxNGIsCompileable %s\n", "Problem in RelaxNGIsCompilable %s\n",
xmlRelaxNGDefName(def)); xmlRelaxNGDefName(def));
} }
#endif #endif
@ -3047,7 +3047,7 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
switch (def->type) { switch (def->type) {
case XML_RELAXNG_START: case XML_RELAXNG_START:
if ((xmlRelaxNGIsCompileable(def) == 1) && (def->depth != -25)) { if ((xmlRelaxNGIsCompilable(def) == 1) && (def->depth != -25)) {
xmlAutomataPtr oldam = ctxt->am; xmlAutomataPtr oldam = ctxt->am;
xmlAutomataStatePtr oldstate = ctxt->state; xmlAutomataStatePtr oldstate = ctxt->state;
@ -3273,7 +3273,7 @@ xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
if ((def->type == XML_RELAXNG_START) || if ((def->type == XML_RELAXNG_START) ||
(def->type == XML_RELAXNG_ELEMENT)) { (def->type == XML_RELAXNG_ELEMENT)) {
ret = xmlRelaxNGIsCompileable(def); ret = xmlRelaxNGIsCompilable(def);
if ((def->dflags & IS_COMPILABLE) && (def->depth != -25)) { if ((def->dflags & IS_COMPILABLE) && (def->depth != -25)) {
ctxt->am = NULL; ctxt->am = NULL;
ret = xmlRelaxNGCompile(ctxt, def); ret = xmlRelaxNGCompile(ctxt, def);
@ -3478,7 +3478,7 @@ xmlRelaxNGIsBlank(xmlChar * str)
* *
* Applies algorithm from 4.3. datatypeLibrary attribute * Applies algorithm from 4.3. datatypeLibrary attribute
* *
* Returns the datatypeLibary value or NULL if not found * Returns the datatypeLibrary value or NULL if not found
*/ */
static xmlChar * static xmlChar *
xmlRelaxNGGetDataTypeLibrary(xmlRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlRelaxNGGetDataTypeLibrary(xmlRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
@ -3788,7 +3788,7 @@ static const xmlChar *invalidName = BAD_CAST "\1";
* that if both lists do not accept the same QNames, it returns 1 * that if both lists do not accept the same QNames, it returns 1
* If the 2 lists can accept the same QName the comparison returns 0 * If the 2 lists can accept the same QName the comparison returns 0
* *
* Returns 1 disttinct, 0 if equal * Returns 1 distinct, 0 if equal
*/ */
static int static int
xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1, xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1,
@ -3889,7 +3889,7 @@ xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1,
* is that if both lists do not accept the same QNames, it returns 1 * is that if both lists do not accept the same QNames, it returns 1
* If the 2 lists can accept the same QName the comparison returns 0 * If the 2 lists can accept the same QName the comparison returns 0
* *
* Returns 1 disttinct, 0 if equal * Returns 1 distinct, 0 if equal
*/ */
static int static int
xmlRelaxNGCompareElemDefLists(xmlRelaxNGParserCtxtPtr ctxt xmlRelaxNGCompareElemDefLists(xmlRelaxNGParserCtxtPtr ctxt
@ -4743,9 +4743,9 @@ xmlRelaxNGParseImportRefs(xmlRelaxNGParserCtxtPtr ctxt,
/** /**
* xmlRelaxNGProcessExternalRef: * xmlRelaxNGProcessExternalRef:
* @ctxt: the parser context * @ctxt: the parser context
* @node: the externlRef node * @node: the externalRef node
* *
* Process and compile an externlRef node * Process and compile an externalRef node
* *
* Returns the xmlRelaxNGDefinePtr or NULL in case of error * Returns the xmlRelaxNGDefinePtr or NULL in case of error
*/ */
@ -5548,12 +5548,16 @@ xmlRelaxNGParsePatterns(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes,
while (nodes != NULL) { while (nodes != NULL) {
if (IS_RELAXNG(nodes, "element")) { if (IS_RELAXNG(nodes, "element")) {
cur = xmlRelaxNGParseElement(ctxt, nodes); cur = xmlRelaxNGParseElement(ctxt, nodes);
if (cur == NULL)
return (NULL);
if (def == NULL) { if (def == NULL) {
def = last = cur; def = last = cur;
} else { } else {
if ((group == 1) && (def->type == XML_RELAXNG_ELEMENT) && if ((group == 1) && (def->type == XML_RELAXNG_ELEMENT) &&
(def == last)) { (def == last)) {
def = xmlRelaxNGNewDefine(ctxt, nodes); def = xmlRelaxNGNewDefine(ctxt, nodes);
if (def == NULL)
return (NULL);
def->type = XML_RELAXNG_GROUP; def->type = XML_RELAXNG_GROUP;
def->content = last; def->content = last;
} }
@ -6012,7 +6016,7 @@ xmlRelaxNGCheckCycles(xmlRelaxNGParserCtxtPtr ctxt,
* @parent: the parent definition * @parent: the parent definition
* @prev: the previous sibling definition * @prev: the previous sibling definition
* *
* Try to unlink a definition. If not possble make it a NOOP * Try to unlink a definition. If not possible make it a NOOP
* *
* Returns the new prev definition * Returns the new prev definition
*/ */
@ -6395,7 +6399,10 @@ xmlRelaxNGCheckRules(xmlRelaxNGParserCtxtPtr ctxt,
NULL, NULL); NULL, NULL);
} }
if ((!(flags & XML_RELAXNG_IN_ONEORMORE)) if ((!(flags & XML_RELAXNG_IN_ONEORMORE))
&& (cur->name == NULL)) { && cur->name == NULL
/* following is checking alternative name class readiness
in case it went the "choice" route */
&& cur->nameClass == NULL) {
if (cur->ns == NULL) { if (cur->ns == NULL) {
xmlRngPErr(ctxt, cur->node, XML_RNGP_ANYNAME_ATTR_ANCESTOR, xmlRngPErr(ctxt, cur->node, XML_RNGP_ANYNAME_ATTR_ANCESTOR,
"Found anyName attribute without oneOrMore ancestor\n", "Found anyName attribute without oneOrMore ancestor\n",
@ -6659,7 +6666,7 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes)
* @node: the root node of the RelaxNG schema * @node: the root node of the RelaxNG schema
* *
* parse a Relax-NG definition resource and build an internal * parse a Relax-NG definition resource and build an internal
* xmlRelaxNG struture which can be used to validate instances. * xmlRelaxNG structure which can be used to validate instances.
* *
* Returns the internal XML RelaxNG structure built or * Returns the internal XML RelaxNG structure built or
* NULL in case of error * NULL in case of error
@ -7490,7 +7497,7 @@ xmlRelaxNGCleanupDoc(xmlRelaxNGParserCtxtPtr ctxt, xmlDocPtr doc)
* @ctxt: a Relax-NG parser context * @ctxt: a Relax-NG parser context
* *
* parse a schema definition resource and build an internal * parse a schema definition resource and build an internal
* XML Shema struture which can be used to validate instances. * XML Schema structure which can be used to validate instances.
* *
* Returns the internal XML RelaxNG structure built from the resource or * Returns the internal XML RelaxNG structure built from the resource or
* NULL in case of error * NULL in case of error
@ -8603,7 +8610,7 @@ xmlRelaxNGNormalize(xmlRelaxNGValidCtxtPtr ctxt, const xmlChar * str)
* @type: the datatype definition * @type: the datatype definition
* @node: the node * @node: the node
* *
* Validate the given value against the dataype * Validate the given value against the datatype
* *
* Returns 0 if the validation succeeded or an error code. * Returns 0 if the validation succeeded or an error code.
*/ */
@ -9476,7 +9483,17 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGFreeValidState(ctxt, oldstate); xmlRelaxNGFreeValidState(ctxt, oldstate);
oldstate = ctxt->state; oldstate = ctxt->state;
ctxt->state = NULL; ctxt->state = NULL;
if (cur != NULL) { if (cur != NULL
/* there's a nasty violation of context-free unambiguities,
since in open-name-class context, interleave in the
production shall finish without caring about anything
else that is OK to follow in that case -- it would
otherwise get marked as "extra content" and would
hence fail the validation, hence this perhaps
dirty attempt to rectify such a situation */
&& (define->parent->type != XML_RELAXNG_DEF
|| !xmlStrEqual(define->parent->name,
(const xmlChar *) "open-name-class"))) {
VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name); VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name);
ret = -1; ret = -1;
ctxt->state = oldstate; ctxt->state = oldstate;
@ -9749,7 +9766,7 @@ xmlRelaxNGElementMatch(xmlRelaxNGValidCtxtPtr ctxt,
* Find the "best" state in the ctxt->states list of states to report * Find the "best" state in the ctxt->states list of states to report
* errors about. I.e. a state with no element left in the child list * errors about. I.e. a state with no element left in the child list
* or the one with the less attributes left. * or the one with the less attributes left.
* This is called only if a falidation error was detected * This is called only if a validation error was detected
* *
* Returns the index of the "best" state or -1 in case of error * Returns the index of the "best" state or -1 in case of error
*/ */
@ -9891,7 +9908,6 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
ctxt->depth++; ctxt->depth++;
switch (define->type) { switch (define->type) {
case XML_RELAXNG_EMPTY: case XML_RELAXNG_EMPTY:
xmlRelaxNGSkipIgnored(ctxt, node);
ret = 0; ret = 0;
break; break;
case XML_RELAXNG_NOT_ALLOWED: case XML_RELAXNG_NOT_ALLOWED:
@ -10357,7 +10373,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
/* /*
* Something we can optimize cleanly there is only one * Something we can optimize cleanly there is only one
* possble branch out ! * possible branch out !
*/ */
if ((node->type == XML_TEXT_NODE) || if ((node->type == XML_TEXT_NODE) ||
(node->type == XML_CDATA_SECTION_NODE)) { (node->type == XML_CDATA_SECTION_NODE)) {
@ -10610,7 +10626,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
if (define->name != NULL) if (define->name != NULL)
xmlGenericError(xmlGenericErrorContext, "%s ", define->name); xmlGenericError(xmlGenericErrorContext, "%s ", define->name);
if (ret == 0) if (ret == 0)
xmlGenericError(xmlGenericErrorContext, "suceeded\n"); xmlGenericError(xmlGenericErrorContext, "succeeded\n");
else else
xmlGenericError(xmlGenericErrorContext, "failed\n"); xmlGenericError(xmlGenericErrorContext, "failed\n");
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Summary: Internal Interfaces for saving in libxml2 * Summary: Internal Interfaces for saving in libxml2
* Description: this module describes a few interfaces which were * Description: this module describes a few interfaces which were
* addded along with the API changes in 2.9.0 * added along with the API changes in 2.9.0
* those are private routines at this point * those are private routines at this point
* *
* Copy: See Copyright for the status of this software. * Copy: See Copyright for the status of this software.
@ -25,9 +25,10 @@ void xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table);
void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem); void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem);
void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr); void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr);
void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent); void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent);
xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
#endif #endif
xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -1068,7 +1068,7 @@ done:
* @ctxt: a schema validation context * @ctxt: a schema validation context
* *
* parse a schema definition resource and build an internal * parse a schema definition resource and build an internal
* XML Shema struture which can be used to validate instances. * XML Schema structure which can be used to validate instances.
* *
* Returns the internal XML Schematron structure built from the resource or * Returns the internal XML Schematron structure built from the resource or
* NULL in case of error * NULL in case of error
@ -1287,7 +1287,7 @@ xmlSchematronReportOutput(xmlSchematronValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
* Build the string being reported to the user. * Build the string being reported to the user.
* *
* Returns a report string or NULL in case of error. The string needs * Returns a report string or NULL in case of error. The string needs
* to be deallocated by teh caller * to be deallocated by the caller
*/ */
static xmlChar * static xmlChar *
xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt,
@ -1591,7 +1591,7 @@ xmlSchematronNextNode(xmlNodePtr cur) {
* xmlSchematronRunTest: * xmlSchematronRunTest:
* @ctxt: the schema validation context * @ctxt: the schema validation context
* @test: the current test * @test: the current test
* @instance: the document instace tree * @instance: the document instance tree
* @cur: the current node in the instance * @cur: the current node in the instance
* *
* Validate a rule against a tree instance at a given position * Validate a rule against a tree instance at a given position
@ -1655,7 +1655,7 @@ xmlSchematronRunTest(xmlSchematronValidCtxtPtr ctxt,
/** /**
* xmlSchematronValidateDoc: * xmlSchematronValidateDoc:
* @ctxt: the schema validation context * @ctxt: the schema validation context
* @instance: the document instace tree * @instance: the document instance tree
* *
* Validate a tree instance against the schematron * Validate a tree instance against the schematron
* *

View file

@ -27,8 +27,8 @@
#ifdef HAVE_PTHREAD_H #ifdef HAVE_PTHREAD_H
#include <pthread.h> #include <pthread.h>
#elif defined HAVE_WIN32_THREADS #elif defined HAVE_WIN32_THREADS
//#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
//#include <windows.h> #include <windows.h>
#ifndef HAVE_COMPILER_TLS #ifndef HAVE_COMPILER_TLS
#include <process.h> #include <process.h>
#endif #endif
@ -82,7 +82,7 @@ static int libxml_is_threaded = 1;
/* /*
* TODO: this module still uses malloc/free and not xmlMalloc/xmlFree * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree
* to avoid some crazyness since xmlMalloc/xmlFree may actually * to avoid some craziness since xmlMalloc/xmlFree may actually
* be hosted on allocated blocks needing them for the allocation ... * be hosted on allocated blocks needing them for the allocation ...
*/ */
@ -239,7 +239,7 @@ xmlMutexLock(xmlMutexPtr tok)
if (acquire_sem(tok->sem) != B_NO_ERROR) { if (acquire_sem(tok->sem) != B_NO_ERROR) {
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"xmlMutexLock():BeOS:Couldn't aquire semaphore\n"); "xmlMutexLock():BeOS:Couldn't acquire semaphore\n");
#endif #endif
} }
tok->tid = find_thread(NULL); tok->tid = find_thread(NULL);

View file

@ -59,7 +59,7 @@ typedef unsigned __int64 uint64_t;
#define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;} #define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;}
/* Common, type-agnosting functions and constants that we don't want to declare twice. */ /* Common, type-agnostic functions and constants that we don't want to declare twice. */
#ifndef SORT_COMMON_H #ifndef SORT_COMMON_H
#define SORT_COMMON_H #define SORT_COMMON_H
@ -74,7 +74,7 @@ typedef unsigned __int64 uint64_t;
static int compute_minrun(const uint64_t); static int compute_minrun(const uint64_t);
#ifndef CLZ #ifndef CLZ
#ifdef __GNUC__ #if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))
#define CLZ __builtin_clzll #define CLZ __builtin_clzll
#else #else
@ -404,7 +404,8 @@ static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in
j = curr + A; j = curr + A;
k = curr + A + B; k = curr + A + B;
while (k-- > curr) { while (k > curr) {
k--;
if ((i > 0) && (j > curr)) { if ((i > 0) && (j > curr)) {
if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) { if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) {
dst[k] = dst[--j]; dst[k] = dst[--j];

View file

@ -59,7 +59,7 @@ int __xmlRegisterCallbacks = 0;
************************************************************************/ ************************************************************************/
static xmlNsPtr static xmlNsPtr
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); xmlNewReconciledNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
static xmlChar* xmlGetPropNodeValueInternal(const xmlAttr *prop); static xmlChar* xmlGetPropNodeValueInternal(const xmlAttr *prop);
@ -181,7 +181,7 @@ xmlGetEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) {
* @dtd: A pointer to the DTD to search * @dtd: A pointer to the DTD to search
* @name: The entity name * @name: The entity name
* *
* Do an entity lookup in the DTD pararmeter entity hash table and * Do an entity lookup in the DTD parameter entity hash table and
* return the corresponding entity, if found. * return the corresponding entity, if found.
* *
* Returns A pointer to the entity structure or NULL if not found. * Returns A pointer to the entity structure or NULL if not found.
@ -2950,7 +2950,7 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
* Add a new attribute after @prev using @cur as base attribute. * Add a new attribute after @prev using @cur as base attribute.
* When inserting before @cur, @prev is passed as @cur->prev. * When inserting before @cur, @prev is passed as @cur->prev.
* When inserting after @cur, @prev is passed as @cur. * When inserting after @cur, @prev is passed as @cur.
* If an existing attribute is found it is detroyed prior to adding @prop. * If an existing attribute is found it is destroyed prior to adding @prop.
* *
* Returns the attribute being inserted or NULL in case of error. * Returns the attribute being inserted or NULL in case of error.
*/ */
@ -3664,7 +3664,9 @@ xmlNextElementSibling(xmlNodePtr node) {
void void
xmlFreeNodeList(xmlNodePtr cur) { xmlFreeNodeList(xmlNodePtr cur) {
xmlNodePtr next; xmlNodePtr next;
xmlNodePtr parent;
xmlDictPtr dict = NULL; xmlDictPtr dict = NULL;
size_t depth = 0;
if (cur == NULL) return; if (cur == NULL) return;
if (cur->type == XML_NAMESPACE_DECL) { if (cur->type == XML_NAMESPACE_DECL) {
@ -3680,16 +3682,21 @@ xmlFreeNodeList(xmlNodePtr cur) {
return; return;
} }
if (cur->doc != NULL) dict = cur->doc->dict; if (cur->doc != NULL) dict = cur->doc->dict;
while (cur != NULL) { while (1) {
while ((cur->children != NULL) &&
(cur->type != XML_DTD_NODE) &&
(cur->type != XML_ENTITY_REF_NODE)) {
cur = cur->children;
depth += 1;
}
next = cur->next; next = cur->next;
parent = cur->parent;
if (cur->type != XML_DTD_NODE) { if (cur->type != XML_DTD_NODE) {
if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
xmlDeregisterNodeDefaultValue(cur); xmlDeregisterNodeDefaultValue(cur);
if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE))
xmlFreeNodeList(cur->children);
if (((cur->type == XML_ELEMENT_NODE) || if (((cur->type == XML_ELEMENT_NODE) ||
(cur->type == XML_XINCLUDE_START) || (cur->type == XML_XINCLUDE_START) ||
(cur->type == XML_XINCLUDE_END)) && (cur->type == XML_XINCLUDE_END)) &&
@ -3720,7 +3727,16 @@ xmlFreeNodeList(xmlNodePtr cur) {
DICT_FREE(cur->name) DICT_FREE(cur->name)
xmlFree(cur); xmlFree(cur);
} }
cur = next;
if (next != NULL) {
cur = next;
} else {
if ((depth == 0) || (parent == NULL))
break;
depth -= 1;
cur = parent;
cur->children = NULL;
}
} }
} }
@ -4050,7 +4066,7 @@ xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
} else { } else {
/* /*
* we have to find something appropriate here since * we have to find something appropriate here since
* we cant be sure, that the namespce we found is identified * we cant be sure, that the namespace we found is identified
* by the prefix * by the prefix
*/ */
if (xmlStrEqual(ns->href, cur->ns->href)) { if (xmlStrEqual(ns->href, cur->ns->href)) {
@ -4058,10 +4074,10 @@ xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
ret->ns = ns; ret->ns = ns;
} else { } else {
/* /*
* we are in trouble: we need a new reconcilied namespace. * we are in trouble: we need a new reconciled namespace.
* This is expensive * This is expensive
*/ */
ret->ns = xmlNewReconciliedNs(target->doc, target, cur->ns); ret->ns = xmlNewReconciledNs(target->doc, target, cur->ns);
} }
} }
@ -4154,8 +4170,8 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
* say RPM:Copyright without changing the namespace pointer to * say RPM:Copyright without changing the namespace pointer to
* something else can produce stale links. One way to do it is * something else can produce stale links. One way to do it is
* to keep a reference counter but this doesn't work as soon * to keep a reference counter but this doesn't work as soon
* as one move the element or the subtree out of the scope of * as one moves the element or the subtree out of the scope of
* the existing namespace. The actual solution seems to add * the existing namespace. The actual solution seems to be to add
* a copy of the namespace at the top of the copied tree if * a copy of the namespace at the top of the copied tree if
* not available in the subtree. * not available in the subtree.
* Hence two functions, the public front-end call the inner ones * Hence two functions, the public front-end call the inner ones
@ -4280,7 +4296,7 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
while (root->parent != NULL) root = root->parent; while (root->parent != NULL) root = root->parent;
ret->ns = xmlNewNs(root, ns->href, ns->prefix); ret->ns = xmlNewNs(root, ns->href, ns->prefix);
} else { } else {
ret->ns = xmlNewReconciliedNs(doc, ret, node->ns); ret->ns = xmlNewReconciledNs(doc, ret, node->ns);
} }
} else { } else {
/* /*
@ -4719,7 +4735,7 @@ xmlGetNodePath(const xmlNode *node)
/* /*
* Thumbler index computation * Thumbler index computation
* TODO: the ocurence test seems bogus for namespaced names * TODO: the occurrence test seems bogus for namespaced names
*/ */
tmp = cur->prev; tmp = cur->prev;
while (tmp != NULL) { while (tmp != NULL) {
@ -6214,7 +6230,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
} }
/** /**
* xmlNewReconciliedNs: * xmlNewReconciledNs:
* @doc: the document * @doc: the document
* @tree: a node expected to hold the new namespace * @tree: a node expected to hold the new namespace
* @ns: the original namespace * @ns: the original namespace
@ -6227,7 +6243,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
* Returns the (new) namespace definition or NULL in case of error * Returns the (new) namespace definition or NULL in case of error
*/ */
static xmlNsPtr static xmlNsPtr
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) { xmlNewReconciledNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
xmlNsPtr def; xmlNsPtr def;
xmlChar prefix[50]; xmlChar prefix[50];
int counter = 1; int counter = 1;
@ -6235,14 +6251,14 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
if ((tree == NULL) || (tree->type != XML_ELEMENT_NODE)) { if ((tree == NULL) || (tree->type != XML_ELEMENT_NODE)) {
#ifdef DEBUG_TREE #ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"xmlNewReconciliedNs : tree == NULL\n"); "xmlNewReconciledNs : tree == NULL\n");
#endif #endif
return(NULL); return(NULL);
} }
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) { if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) {
#ifdef DEBUG_TREE #ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"xmlNewReconciliedNs : ns == NULL\n"); "xmlNewReconciledNs : ns == NULL\n");
#endif #endif
return(NULL); return(NULL);
} }
@ -6344,7 +6360,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
/* /*
* OK we need to recreate a new namespace definition * OK we need to recreate a new namespace definition
*/ */
n = xmlNewReconciliedNs(doc, tree, node->ns); n = xmlNewReconciledNs(doc, tree, node->ns);
if (n != NULL) { /* :-( what if else ??? */ if (n != NULL) { /* :-( what if else ??? */
/* /*
* check if we need to grow the cache buffers. * check if we need to grow the cache buffers.
@ -6373,7 +6389,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
} }
} }
/* /*
* now check for namespace hold by attributes on the node. * now check for namespace held by attributes on the node.
*/ */
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
attr = node->properties; attr = node->properties;
@ -6408,7 +6424,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
/* /*
* OK we need to recreate a new namespace definition * OK we need to recreate a new namespace definition
*/ */
n = xmlNewReconciliedNs(doc, tree, attr->ns); n = xmlNewReconciledNs(doc, tree, attr->ns);
if (n != NULL) { /* :-( what if else ??? */ if (n != NULL) { /* :-( what if else ??? */
/* /*
* check if we need to grow the cache buffers. * check if we need to grow the cache buffers.
@ -7961,7 +7977,7 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position,
* Creates or reuses an xmlNs struct on doc->oldNs with * Creates or reuses an xmlNs struct on doc->oldNs with
* the given prefix and namespace name. * the given prefix and namespace name.
* *
* Returns the aquired ns struct or NULL in case of an API * Returns the acquired ns struct or NULL in case of an API
* or internal error. * or internal error.
*/ */
static xmlNsPtr static xmlNsPtr
@ -8575,7 +8591,7 @@ ns_next_prefix:
} }
/* /*
* xmlDOMWrapNSNormAquireNormalizedNs: * xmlDOMWrapNSNormAcquireNormalizedNs:
* @doc: the doc * @doc: the doc
* @elem: the element-node to declare namespaces on * @elem: the element-node to declare namespaces on
* @ns: the ns-struct to use for the search * @ns: the ns-struct to use for the search
@ -8594,7 +8610,7 @@ ns_next_prefix:
* Returns 0 if succeeded, -1 otherwise and on API/internal errors. * Returns 0 if succeeded, -1 otherwise and on API/internal errors.
*/ */
static int static int
xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, xmlDOMWrapNSNormAcquireNormalizedNs(xmlDocPtr doc,
xmlNodePtr elem, xmlNodePtr elem,
xmlNsPtr ns, xmlNsPtr ns,
xmlNsPtr *retNs, xmlNsPtr *retNs,
@ -8893,9 +8909,9 @@ next_ns_decl:
} }
} }
/* /*
* Aquire a normalized ns-decl and add it to the map. * Acquire a normalized ns-decl and add it to the map.
*/ */
if (xmlDOMWrapNSNormAquireNormalizedNs(doc, curElem, if (xmlDOMWrapNSNormAcquireNormalizedNs(doc, curElem,
cur->ns, &ns, cur->ns, &ns,
&nsMap, depth, &nsMap, depth,
ancestorsOnly, ancestorsOnly,
@ -9033,7 +9049,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
nsMap = (xmlNsMapPtr) ctxt->namespaceMap; nsMap = (xmlNsMapPtr) ctxt->namespaceMap;
/* /*
* Disable search for ns-decls in the parent-axis of the * Disable search for ns-decls in the parent-axis of the
* desination element, if: * destination element, if:
* 1) there's no destination parent * 1) there's no destination parent
* 2) custom ns-reference handling is used * 2) custom ns-reference handling is used
*/ */
@ -9178,9 +9194,9 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
cur->ns = ns; cur->ns = ns;
} else { } else {
/* /*
* Aquire a normalized ns-decl and add it to the map. * Acquire a normalized ns-decl and add it to the map.
*/ */
if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc, if (xmlDOMWrapNSNormAcquireNormalizedNs(destDoc,
/* ns-decls on curElem or on destDoc->oldNs */ /* ns-decls on curElem or on destDoc->oldNs */
destParent ? curElem : NULL, destParent ? curElem : NULL,
cur->ns, &ns, cur->ns, &ns,
@ -9234,7 +9250,7 @@ ns_end:
goto leave_node; goto leave_node;
case XML_ENTITY_REF_NODE: case XML_ENTITY_REF_NODE:
/* /*
* Remove reference to the entitity-node. * Remove reference to the entity-node.
*/ */
cur->content = NULL; cur->content = NULL;
cur->children = NULL; cur->children = NULL;
@ -9468,7 +9484,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
} }
memset(clone, 0, sizeof(xmlNode)); memset(clone, 0, sizeof(xmlNode));
/* /*
* Set hierachical links. * Set hierarchical links.
*/ */
if (resultClone != NULL) { if (resultClone != NULL) {
clone->parent = parentClone; clone->parent = parentClone;
@ -9492,7 +9508,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
} }
memset(clone, 0, sizeof(xmlAttr)); memset(clone, 0, sizeof(xmlAttr));
/* /*
* Set hierachical links. * Set hierarchical links.
* TODO: Change this to add to the end of attributes. * TODO: Change this to add to the end of attributes.
*/ */
if (resultClone != NULL) { if (resultClone != NULL) {
@ -9720,9 +9736,9 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
clone->ns = ns; clone->ns = ns;
} else { } else {
/* /*
* Aquire a normalized ns-decl and add it to the map. * Acquire a normalized ns-decl and add it to the map.
*/ */
if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc, if (xmlDOMWrapNSNormAcquireNormalizedNs(destDoc,
/* ns-decls on curElem or on destDoc->oldNs */ /* ns-decls on curElem or on destDoc->oldNs */
destParent ? curElem : NULL, destParent ? curElem : NULL,
cur->ns, &ns, cur->ns, &ns,
@ -9959,7 +9975,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt,
break; break;
case XML_ENTITY_REF_NODE: case XML_ENTITY_REF_NODE:
/* /*
* Remove reference to the entitity-node. * Remove reference to the entity-node.
*/ */
cur->content = NULL; cur->content = NULL;
cur->children = NULL; cur->children = NULL;
@ -10097,7 +10113,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt,
break; break;
case XML_ENTITY_REF_NODE: case XML_ENTITY_REF_NODE:
/* /*
* Remove reference to the entitity-node. * Remove reference to the entity-node.
*/ */
node->content = NULL; node->content = NULL;
node->children = NULL; node->children = NULL;

View file

@ -2610,7 +2610,7 @@ TRIO_ARGS5((self, wstring, flags, width, precision),
* *
* The accuracy [...] is implementation defined, as is the accuracy * The accuracy [...] is implementation defined, as is the accuracy
* of the conversion between floating-point internal representations * of the conversion between floating-point internal representations
* and string representations performed by the libray routine in * and string representations performed by the library routine in
* <stdio.h>" * <stdio.h>"
*/ */
/* FIXME: handle all instances of constant long-double number (L) /* FIXME: handle all instances of constant long-double number (L)
@ -5899,7 +5899,7 @@ TRIO_ARGS4((self, target, flags, width),
} }
if (trio_equal(doubleString, NAN_UPPER)) if (trio_equal(doubleString, NAN_UPPER))
{ {
/* NaN must not have a preceeding + nor - */ /* NaN must not have a preceding + nor - */
if (flags & FLAGS_LONGDOUBLE) if (flags & FLAGS_LONGDOUBLE)
{ {
*((trio_long_double_t *)target) = trio_nan(); *((trio_long_double_t *)target) = trio_nan();

View file

@ -92,7 +92,7 @@
/* /*
* In ANSI/IEEE 754-1985 64-bits double format numbers have the * In ANSI/IEEE 754-1985 64-bits double format numbers have the
* following properties (amoungst others) * following properties (amongst others)
* *
* o FLT_RADIX == 2: binary encoding * o FLT_RADIX == 2: binary encoding
* o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used * o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used
@ -327,7 +327,7 @@ trio_nan(TRIO_NOARGS)
if (result == 0.0) { if (result == 0.0) {
#if defined(TRIO_COMPILER_SUPPORTS_C99) && !defined(__clang__) #if defined(TRIO_COMPILER_SUPPORTS_C99) && (!defined(__REACTOS__) || !defined(__clang__))
result = nan(""); result = nan("");
#elif defined(NAN) && defined(__STDC_IEC_559__) #elif defined(NAN) && defined(__STDC_IEC_559__)

View file

@ -22,7 +22,7 @@
* MAX_URI_LENGTH: * MAX_URI_LENGTH:
* *
* The definition of the URI regexp in the above RFC has no size limit * The definition of the URI regexp in the above RFC has no size limit
* In practice they are usually relativey short except for the * In practice they are usually relatively short except for the
* data URI scheme as defined in RFC 2397. Even for data URI the usual * data URI scheme as defined in RFC 2397. Even for data URI the usual
* maximum size before hitting random practical limits is around 64 KB * maximum size before hitting random practical limits is around 64 KB
* and 4KB is usually a maximum admitted limit for proper operations. * and 4KB is usually a maximum admitted limit for proper operations.
@ -325,16 +325,18 @@ static int
xmlParse3986Port(xmlURIPtr uri, const char **str) xmlParse3986Port(xmlURIPtr uri, const char **str)
{ {
const char *cur = *str; const char *cur = *str;
unsigned port = 0; /* unsigned for defined overflow behavior */ int port = 0;
if (ISA_DIGIT(cur)) { if (ISA_DIGIT(cur)) {
while (ISA_DIGIT(cur)) { while (ISA_DIGIT(cur)) {
port = port * 10 + (*cur - '0'); port = port * 10 + (*cur - '0');
if (port > 99999999)
port = 99999999;
cur++; cur++;
} }
if (uri != NULL) if (uri != NULL)
uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */ uri->port = port;
*str = cur; *str = cur;
return(0); return(0);
} }
@ -436,7 +438,7 @@ xmlParse3986Host(xmlURIPtr uri, const char **str)
host = cur; host = cur;
/* /*
* IPv6 and future adressing scheme are enclosed between brackets * IPv6 and future addressing scheme are enclosed between brackets
*/ */
if (*cur == '[') { if (*cur == '[') {
cur++; cur++;
@ -1456,7 +1458,7 @@ xmlNormalizeURIPath(char *path) {
goto done_cd; goto done_cd;
(out++)[0] = (cur++)[0]; (out++)[0] = (cur++)[0];
} }
/* nomalize // */ /* normalize // */
while ((cur[0] == '/') && (cur[1] == '/')) while ((cur[0] == '/') && (cur[1] == '/'))
cur++; cur++;
@ -2150,7 +2152,7 @@ done:
* http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif * http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif
* *
* *
* Note: if the URI reference is really wierd or complicated, it may be * Note: if the URI reference is really weird or complicated, it may be
* worthwhile to first convert it into a "nice" one by calling * worthwhile to first convert it into a "nice" one by calling
* xmlBuildURI (using 'base') before calling this routine, * xmlBuildURI (using 'base') before calling this routine,
* since this routine (for reasonable efficiency) assumes URI has * since this routine (for reasonable efficiency) assumes URI has
@ -2461,7 +2463,7 @@ path_processing:
/* allocate space for leading '/' + path + string terminator */ /* allocate space for leading '/' + path + string terminator */
uri->path = xmlMallocAtomic(len + 2); uri->path = xmlMallocAtomic(len + 2);
if (uri->path == NULL) { if (uri->path == NULL) {
xmlFreeURI(uri); /* Guard agains 'out of memory' */ xmlFreeURI(uri); /* Guard against 'out of memory' */
return(NULL); return(NULL);
} }
/* Put in leading '/' plus path */ /* Put in leading '/' plus path */
@ -2476,7 +2478,7 @@ path_processing:
} }
p = uri->path; p = uri->path;
} }
/* Now change all occurences of '\' to '/' */ /* Now change all occurrences of '\' to '/' */
while (*p != '\0') { while (*p != '\0') {
if (*p == '\\') if (*p == '\\')
*p = '/'; *p = '/';
@ -2526,7 +2528,7 @@ xmlPathToURI(const xmlChar *path)
return(NULL); return(NULL);
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
/* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?)
If 'cal' is a valid URI allready then we are done here, as continuing would make If 'cal' is a valid URI already then we are done here, as continuing would make
it invalid. */ it invalid. */
if ((uri = xmlParseURI((const char *) cal)) != NULL) { if ((uri = xmlParseURI((const char *) cal)) != NULL) {
xmlFreeURI(uri); xmlFreeURI(uri);

View file

@ -1099,14 +1099,22 @@ xmlCopyElementContent(xmlElementContentPtr cur) {
*/ */
void void
xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
xmlElementContentPtr next;
xmlDictPtr dict = NULL; xmlDictPtr dict = NULL;
size_t depth = 0;
if (cur == NULL)
return;
if (doc != NULL) if (doc != NULL)
dict = doc->dict; dict = doc->dict;
while (cur != NULL) { while (1) {
next = cur->c2; xmlElementContentPtr parent;
while ((cur->c1 != NULL) || (cur->c2 != NULL)) {
cur = (cur->c1 != NULL) ? cur->c1 : cur->c2;
depth += 1;
}
switch (cur->type) { switch (cur->type) {
case XML_ELEMENT_CONTENT_PCDATA: case XML_ELEMENT_CONTENT_PCDATA:
case XML_ELEMENT_CONTENT_ELEMENT: case XML_ELEMENT_CONTENT_ELEMENT:
@ -1119,7 +1127,6 @@ xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
NULL); NULL);
return; return;
} }
if (cur->c1 != NULL) xmlFreeDocElementContent(doc, cur->c1);
if (dict) { if (dict) {
if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name))) if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name)))
xmlFree((xmlChar *) cur->name); xmlFree((xmlChar *) cur->name);
@ -1129,8 +1136,23 @@ xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
if (cur->name != NULL) xmlFree((xmlChar *) cur->name); if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix); if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix);
} }
parent = cur->parent;
if ((depth == 0) || (parent == NULL)) {
xmlFree(cur);
break;
}
if (cur == parent->c1)
parent->c1 = NULL;
else
parent->c2 = NULL;
xmlFree(cur); xmlFree(cur);
cur = next;
if (parent->c2 != NULL) {
cur = parent->c2;
} else {
depth -= 1;
cur = parent;
}
} }
} }
@ -1147,82 +1169,103 @@ xmlFreeElementContent(xmlElementContentPtr cur) {
} }
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpElementOccur:
* @buf: An XML buffer
* @cur: An element table
*
* Dump the occurence operator of an element.
*/
static void
xmlDumpElementOccur(xmlBufferPtr buf, xmlElementContentPtr cur) {
switch (cur->ocur) {
case XML_ELEMENT_CONTENT_ONCE:
break;
case XML_ELEMENT_CONTENT_OPT:
xmlBufferWriteChar(buf, "?");
break;
case XML_ELEMENT_CONTENT_MULT:
xmlBufferWriteChar(buf, "*");
break;
case XML_ELEMENT_CONTENT_PLUS:
xmlBufferWriteChar(buf, "+");
break;
}
}
/** /**
* xmlDumpElementContent: * xmlDumpElementContent:
* @buf: An XML buffer * @buf: An XML buffer
* @content: An element table * @content: An element table
* @glob: 1 if one must print the englobing parenthesis, 0 otherwise
* *
* This will dump the content of the element table as an XML DTD definition * This will dump the content of the element table as an XML DTD definition
*/ */
static void static void
xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) { xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content) {
xmlElementContentPtr cur;
if (content == NULL) return; if (content == NULL) return;
if (glob) xmlBufferWriteChar(buf, "("); xmlBufferWriteChar(buf, "(");
switch (content->type) { cur = content;
case XML_ELEMENT_CONTENT_PCDATA:
xmlBufferWriteChar(buf, "#PCDATA"); do {
break; if (cur == NULL) return;
case XML_ELEMENT_CONTENT_ELEMENT:
if (content->prefix != NULL) { switch (cur->type) {
xmlBufferWriteCHAR(buf, content->prefix); case XML_ELEMENT_CONTENT_PCDATA:
xmlBufferWriteChar(buf, ":"); xmlBufferWriteChar(buf, "#PCDATA");
} break;
xmlBufferWriteCHAR(buf, content->name); case XML_ELEMENT_CONTENT_ELEMENT:
break; if (cur->prefix != NULL) {
case XML_ELEMENT_CONTENT_SEQ: xmlBufferWriteCHAR(buf, cur->prefix);
if ((content->c1 != NULL) && xmlBufferWriteChar(buf, ":");
((content->c1->type == XML_ELEMENT_CONTENT_OR) || }
(content->c1->type == XML_ELEMENT_CONTENT_SEQ))) xmlBufferWriteCHAR(buf, cur->name);
xmlDumpElementContent(buf, content->c1, 1); break;
else case XML_ELEMENT_CONTENT_SEQ:
xmlDumpElementContent(buf, content->c1, 0); case XML_ELEMENT_CONTENT_OR:
xmlBufferWriteChar(buf, " , "); if ((cur != content) &&
if ((content->c2 != NULL) && (cur->parent != NULL) &&
((content->c2->type == XML_ELEMENT_CONTENT_OR) || ((cur->type != cur->parent->type) ||
((content->c2->type == XML_ELEMENT_CONTENT_SEQ) && (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
(content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))) xmlBufferWriteChar(buf, "(");
xmlDumpElementContent(buf, content->c2, 1); cur = cur->c1;
else continue;
xmlDumpElementContent(buf, content->c2, 0); default:
break; xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
case XML_ELEMENT_CONTENT_OR: "Internal: ELEMENT cur corrupted invalid type\n",
if ((content->c1 != NULL) && NULL);
((content->c1->type == XML_ELEMENT_CONTENT_OR) || }
(content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
xmlDumpElementContent(buf, content->c1, 1); while (cur != content) {
else xmlElementContentPtr parent = cur->parent;
xmlDumpElementContent(buf, content->c1, 0);
xmlBufferWriteChar(buf, " | "); if (parent == NULL) return;
if ((content->c2 != NULL) &&
((content->c2->type == XML_ELEMENT_CONTENT_SEQ) || if (((cur->type == XML_ELEMENT_CONTENT_OR) ||
((content->c2->type == XML_ELEMENT_CONTENT_OR) && (cur->type == XML_ELEMENT_CONTENT_SEQ)) &&
(content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))) ((cur->type != parent->type) ||
xmlDumpElementContent(buf, content->c2, 1); (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
else xmlBufferWriteChar(buf, ")");
xmlDumpElementContent(buf, content->c2, 0); xmlDumpElementOccur(buf, cur);
break;
default: if (cur == parent->c1) {
xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, if (parent->type == XML_ELEMENT_CONTENT_SEQ)
"Internal: ELEMENT content corrupted invalid type\n", xmlBufferWriteChar(buf, " , ");
NULL); else if (parent->type == XML_ELEMENT_CONTENT_OR)
} xmlBufferWriteChar(buf, " | ");
if (glob)
xmlBufferWriteChar(buf, ")"); cur = parent->c2;
switch (content->ocur) { break;
case XML_ELEMENT_CONTENT_ONCE: }
break;
case XML_ELEMENT_CONTENT_OPT: cur = parent;
xmlBufferWriteChar(buf, "?"); }
break; } while (cur != content);
case XML_ELEMENT_CONTENT_MULT:
xmlBufferWriteChar(buf, "*"); xmlBufferWriteChar(buf, ")");
break; xmlDumpElementOccur(buf, content);
case XML_ELEMENT_CONTENT_PLUS:
xmlBufferWriteChar(buf, "+");
break;
}
} }
/** /**
@ -1703,7 +1746,7 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
} }
xmlBufferWriteCHAR(buf, elem->name); xmlBufferWriteCHAR(buf, elem->name);
xmlBufferWriteChar(buf, " "); xmlBufferWriteChar(buf, " ");
xmlDumpElementContent(buf, elem->content, 1); xmlDumpElementContent(buf, elem->content);
xmlBufferWriteChar(buf, ">\n"); xmlBufferWriteChar(buf, ">\n");
break; break;
case XML_ELEMENT_TYPE_ELEMENT: case XML_ELEMENT_TYPE_ELEMENT:
@ -1714,7 +1757,7 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
} }
xmlBufferWriteCHAR(buf, elem->name); xmlBufferWriteCHAR(buf, elem->name);
xmlBufferWriteChar(buf, " "); xmlBufferWriteChar(buf, " ");
xmlDumpElementContent(buf, elem->content, 1); xmlDumpElementContent(buf, elem->content);
xmlBufferWriteChar(buf, ">\n"); xmlBufferWriteChar(buf, ">\n");
break; break;
default: default:
@ -2640,7 +2683,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
ret->doc = doc; ret->doc = doc;
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) { if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
/* /*
* Operating in streaming mode, attr is gonna disapear * Operating in streaming mode, attr is gonna disappear
*/ */
if (doc->dict != NULL) if (doc->dict != NULL)
ret->name = xmlDictLookup(doc->dict, attr->name, -1); ret->name = xmlDictLookup(doc->dict, attr->name, -1);
@ -2968,7 +3011,7 @@ xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
ret->value = xmlStrdup(value); ret->value = xmlStrdup(value);
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) { if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
/* /*
* Operating in streaming mode, attr is gonna disapear * Operating in streaming mode, attr is gonna disappear
*/ */
ret->name = xmlStrdup(attr->name); ret->name = xmlStrdup(attr->name);
ret->attr = NULL; ret->attr = NULL;

View file

@ -449,6 +449,10 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
xmlCtxtUseOptions(pctxt, ctxt->parseFlags | XML_PARSE_DTDLOAD); xmlCtxtUseOptions(pctxt, ctxt->parseFlags | XML_PARSE_DTDLOAD);
/* Don't read from stdin. */
if ((URL != NULL) && (strcmp(URL, "-") == 0))
URL = "./-";
inputStream = xmlLoadExternalEntity(URL, NULL, pctxt); inputStream = xmlLoadExternalEntity(URL, NULL, pctxt);
if (inputStream == NULL) { if (inputStream == NULL) {
xmlFreeParserCtxt(pctxt); xmlFreeParserCtxt(pctxt);
@ -667,7 +671,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
int i; int i;
/* /*
* Avoid recursion in already substitued resources * Avoid recursion in already substituted resources
for (i = 0;i < ctxt->urlNr;i++) { for (i = 0;i < ctxt->urlNr;i++) {
if (xmlStrEqual(doc->URL, ctxt->urlTab[i])) if (xmlStrEqual(doc->URL, ctxt->urlTab[i]))
return; return;
@ -752,7 +756,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
* @txt: the new text node * @txt: the new text node
* @url: the associated URL * @url: the associated URL
* *
* Add a new txtument to the list * Add a new text node to the list
*/ */
static void static void
xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) { xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
@ -1258,7 +1262,7 @@ struct _xmlXIncludeMergeData {
* @doc: the including doc * @doc: the including doc
* @nr: the entity name * @nr: the entity name
* *
* Inplements the merge of one entity * Implements the merge of one entity
*/ */
static void static void
xmlXIncludeMergeEntity(void *payload, void *vdata, xmlXIncludeMergeEntity(void *payload, void *vdata,
@ -1335,7 +1339,7 @@ error:
* @doc: the including doc * @doc: the including doc
* @from: the included doc * @from: the included doc
* *
* Inplements the entity merge * Implements the entity merge
* *
* Returns 0 if merge succeeded, -1 if some processing failed * Returns 0 if merge succeeded, -1 if some processing failed
*/ */
@ -1806,6 +1810,10 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlParserInputPtr inputStream; xmlParserInputPtr inputStream;
int xinclude_multibyte_fallback_used = 0; int xinclude_multibyte_fallback_used = 0;
/* Don't read from stdin. */
if (xmlStrcmp(url, BAD_CAST "-") == 0)
url = BAD_CAST "./-";
/* /*
* Check the URL and remove any fragment identifier * Check the URL and remove any fragment identifier
*/ */
@ -1914,7 +1922,7 @@ xinclude_multibyte_fallback:
cur = xmlStringCurrentChar(NULL, &content[i], &l); cur = xmlStringCurrentChar(NULL, &content[i], &l);
if (!IS_CHAR(cur)) { if (!IS_CHAR(cur)) {
/* Handle splitted multibyte char at buffer boundary */ /* Handle split multibyte char at buffer boundary */
if (((len - i) < 4) && (!xinclude_multibyte_fallback_used)) { if (((len - i) < 4) && (!xinclude_multibyte_fallback_used)) {
xinclude_multibyte_fallback_used = 1; xinclude_multibyte_fallback_used = 1;
xmlBufShrink(buf->buffer, i); xmlBufShrink(buf->buffer, i);
@ -1923,6 +1931,7 @@ xinclude_multibyte_fallback:
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
XML_XINCLUDE_INVALID_CHAR, XML_XINCLUDE_INVALID_CHAR,
"%s contains invalid char\n", URL); "%s contains invalid char\n", URL);
xmlFreeParserCtxt(pctxt);
xmlFreeParserInputBuffer(buf); xmlFreeParserInputBuffer(buf);
xmlFree(URL); xmlFree(URL);
return(-1); return(-1);
@ -1963,6 +1972,7 @@ static int
xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) { xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
xmlXIncludeCtxtPtr newctxt; xmlXIncludeCtxtPtr newctxt;
int ret = 0; int ret = 0;
int oldNbErrors = ctxt->nbErrors;
if ((fallback == NULL) || (fallback->type == XML_NAMESPACE_DECL) || if ((fallback == NULL) || (fallback->type == XML_NAMESPACE_DECL) ||
(ctxt == NULL)) (ctxt == NULL))
@ -1979,7 +1989,7 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
newctxt->base = xmlStrdup(ctxt->base); /* Inherit the base from the existing context */ newctxt->base = xmlStrdup(ctxt->base); /* Inherit the base from the existing context */
xmlXIncludeSetFlags(newctxt, ctxt->parseFlags); xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children); ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children);
if (ctxt->nbErrors > 0) if (ctxt->nbErrors > oldNbErrors)
ret = -1; ret = -1;
else if (ret > 0) else if (ret > 0)
ret = 0; /* xmlXIncludeDoProcess can return +ve number */ ret = 0; /* xmlXIncludeDoProcess can return +ve number */
@ -2133,7 +2143,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
xmlNodePtr children; xmlNodePtr children;
/* /*
* Time to try a fallback if availble * Time to try a fallback if available
*/ */
#ifdef DEBUG_XINCLUDE #ifdef DEBUG_XINCLUDE
xmlGenericError(xmlGenericErrorContext, "error looking for fallback\n"); xmlGenericError(xmlGenericErrorContext, "error looking for fallback\n");
@ -2178,7 +2188,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
* @ctxt: an XInclude context * @ctxt: an XInclude context
* @nr: the node number * @nr: the node number
* *
* Inplement the infoset replacement for the given node * Implement the infoset replacement for the given node
* *
* Returns 0 if substitution succeeded, -1 if some processing failed * Returns 0 if substitution succeeded, -1 if some processing failed
*/ */

View file

@ -189,9 +189,9 @@ static const char *IOerr[] = {
"already connected", /* EISCONN */ "already connected", /* EISCONN */
"connection refused", /* ECONNREFUSED */ "connection refused", /* ECONNREFUSED */
"unreachable network", /* ENETUNREACH */ "unreachable network", /* ENETUNREACH */
"adddress in use", /* EADDRINUSE */ "address in use", /* EADDRINUSE */
"already in use", /* EALREADY */ "already in use", /* EALREADY */
"unknown address familly", /* EAFNOSUPPORT */ "unknown address family", /* EAFNOSUPPORT */
}; };
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
@ -2387,6 +2387,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
if (encoder != NULL) { if (encoder != NULL) {
ret->conv = xmlBufCreateSize(4000); ret->conv = xmlBufCreateSize(4000);
if (ret->conv == NULL) { if (ret->conv == NULL) {
xmlBufFree(ret->buffer);
xmlFree(ret); xmlFree(ret);
return(NULL); return(NULL);
} }
@ -2439,6 +2440,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) {
if (encoder != NULL) { if (encoder != NULL) {
ret->conv = xmlBufCreateSize(4000); ret->conv = xmlBufCreateSize(4000);
if (ret->conv == NULL) { if (ret->conv == NULL) {
xmlBufFree(ret->buffer);
xmlFree(ret); xmlFree(ret);
return(NULL); return(NULL);
} }
@ -3339,7 +3341,7 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
int nbchars = 0; /* number of chars to output to I/O */ int nbchars = 0; /* number of chars to output to I/O */
int ret; /* return from function call */ int ret; /* return from function call */
int written = 0; /* number of char written to I/O so far */ int written = 0; /* number of char written to I/O so far */
int chunk; /* number of byte curreent processed from buf */ int chunk; /* number of byte current processed from buf */
if ((out == NULL) || (out->error)) return(-1); if ((out == NULL) || (out->error)) return(-1);
if (len < 0) return(0); if (len < 0) return(0);
@ -3376,20 +3378,26 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
out->error = XML_IO_ENCODER; out->error = XML_IO_ENCODER;
return(-1); return(-1);
} }
nbchars = xmlBufUse(out->conv); if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
nbchars = ret;
} else { } else {
ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk); ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk);
if (ret != 0) if (ret != 0)
return(-1); return(-1);
nbchars = xmlBufUse(out->buffer); if (out->writecallback)
nbchars = xmlBufUse(out->buffer);
else
nbchars = chunk;
} }
buf += chunk; buf += chunk;
len -= chunk; len -= chunk;
if ((nbchars < MINLEN) && (len <= 0))
goto done;
if (out->writecallback) { if (out->writecallback) {
if ((nbchars < MINLEN) && (len <= 0))
goto done;
/* /*
* second write the stuff to the I/O channel * second write the stuff to the I/O channel
*/ */
@ -3409,7 +3417,10 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
out->error = XML_IO_WRITE; out->error = XML_IO_WRITE;
return(ret); return(ret);
} }
out->written += ret; if (out->written > INT_MAX - ret)
out->written = INT_MAX;
else
out->written += ret;
} }
written += nbchars; written += nbchars;
} while (len > 0); } while (len > 0);
@ -3489,7 +3500,7 @@ xmlEscapeContent(unsigned char* out, int *outlen,
* @escaping: an optional escaping function (or NULL) * @escaping: an optional escaping function (or NULL)
* *
* Write the content of the string in the output I/O buffer * Write the content of the string in the output I/O buffer
* This routine escapes the caracters and then handle the I18N * This routine escapes the characters and then handle the I18N
* transcoding from internal UTF-8 * transcoding from internal UTF-8
* The buffer is lossless, i.e. will store in case of partial * The buffer is lossless, i.e. will store in case of partial
* or delayed writes. * or delayed writes.
@ -3565,21 +3576,27 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
out->error = XML_IO_ENCODER; out->error = XML_IO_ENCODER;
return(-1); return(-1);
} }
nbchars = xmlBufUse(out->conv); if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
nbchars = ret;
} else { } else {
ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons); ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons);
if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */ if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */
return(-1); return(-1);
xmlBufAddLen(out->buffer, chunk); xmlBufAddLen(out->buffer, chunk);
nbchars = xmlBufUse(out->buffer); if (out->writecallback)
nbchars = xmlBufUse(out->buffer);
else
nbchars = chunk;
} }
str += cons; str += cons;
len -= cons; len -= cons;
if ((nbchars < MINLEN) && (len <= 0))
goto done;
if (out->writecallback) { if (out->writecallback) {
if ((nbchars < MINLEN) && (len <= 0))
goto done;
/* /*
* second write the stuff to the I/O channel * second write the stuff to the I/O channel
*/ */
@ -3599,7 +3616,10 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
out->error = XML_IO_WRITE; out->error = XML_IO_WRITE;
return(ret); return(ret);
} }
out->written += ret; if (out->written > INT_MAX - ret)
out->written = INT_MAX;
else
out->written += ret;
} else if (xmlBufAvail(out->buffer) < MINLEN) { } else if (xmlBufAvail(out->buffer) < MINLEN) {
xmlBufGrow(out->buffer, MINLEN); xmlBufGrow(out->buffer, MINLEN);
} }
@ -3693,7 +3713,10 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) {
out->error = XML_IO_FLUSH; out->error = XML_IO_FLUSH;
return(ret); return(ret);
} }
out->written += ret; if (out->written > INT_MAX - ret)
out->written = INT_MAX;
else
out->written += ret;
#ifdef DEBUG_INPUT #ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
@ -3941,7 +3964,7 @@ xmlResolveResourceFromCatalog(const char *URL, const char *ID,
* @ID: the System ID for the entity to load * @ID: the System ID for the entity to load
* @ctxt: the context in which the entity is called or NULL * @ctxt: the context in which the entity is called or NULL
* *
* By default we don't load external entitites, yet. * By default we don't load external entities, yet.
* *
* Returns a new allocated xmlParserInputPtr, or NULL. * Returns a new allocated xmlParserInputPtr, or NULL.
*/ */

View file

@ -180,17 +180,17 @@ static int exc_canonical = 0;
#ifdef LIBXML_READER_ENABLED #ifdef LIBXML_READER_ENABLED
static int stream = 0; static int stream = 0;
static int walker = 0; static int walker = 0;
#ifdef LIBXML_PATTERN_ENABLED
static const char *pattern = NULL;
static xmlPatternPtr patternc = NULL;
static xmlStreamCtxtPtr patstream = NULL;
#endif
#endif /* LIBXML_READER_ENABLED */ #endif /* LIBXML_READER_ENABLED */
static int chkregister = 0; static int chkregister = 0;
static int nbregister = 0; static int nbregister = 0;
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
static int sax1 = 0; static int sax1 = 0;
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
#ifdef LIBXML_PATTERN_ENABLED
static const char *pattern = NULL;
static xmlPatternPtr patternc = NULL;
static xmlStreamCtxtPtr patstream = NULL;
#endif
#ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_XPATH_ENABLED
static const char *xpathquery = NULL; static const char *xpathquery = NULL;
#endif #endif
@ -519,7 +519,7 @@ endTimer(char *format, ...)
#endif #endif
/************************************************************************ /************************************************************************
* * * *
* HTML ouput * * HTML output *
* * * *
************************************************************************/ ************************************************************************/
static char buffer[50000]; static char buffer[50000];
@ -1652,10 +1652,7 @@ testSAX(const char *filename) {
xmlSchemaValidCtxtPtr vctxt; xmlSchemaValidCtxtPtr vctxt;
vctxt = xmlSchemaNewValidCtxt(wxschemas); vctxt = xmlSchemaNewValidCtxt(wxschemas);
xmlSchemaSetValidErrors(vctxt, xmlSchemaSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL);
(xmlSchemaValidityErrorFunc) fprintf,
(xmlSchemaValidityWarningFunc) fprintf,
stderr);
xmlSchemaValidateSetFilename(vctxt, filename); xmlSchemaValidateSetFilename(vctxt, filename);
ret = xmlSchemaValidateStream(vctxt, buf, 0, handler, ret = xmlSchemaValidateStream(vctxt, buf, 0, handler,
@ -2086,7 +2083,7 @@ static void doXPathDump(xmlXPathObjectPtr cur) {
} }
for (i = 0;i < cur->nodesetval->nodeNr;i++) { for (i = 0;i < cur->nodesetval->nodeNr;i++) {
node = cur->nodesetval->nodeTab[i]; node = cur->nodesetval->nodeTab[i];
xmlNodeDumpOutput(buf, node->doc, node, 0, 0, NULL); xmlNodeDumpOutput(buf, NULL, node, 0, 0, NULL);
xmlOutputBufferWrite(buf, 1, "\n"); xmlOutputBufferWrite(buf, 1, "\n");
} }
xmlOutputBufferClose(buf); xmlOutputBufferClose(buf);
@ -2760,9 +2757,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
"Couldn't allocate validation context\n"); "Couldn't allocate validation context\n");
exit(-1); exit(-1);
} }
cvp->userData = (void *) stderr; cvp->userData = NULL;
cvp->error = (xmlValidityErrorFunc) fprintf; cvp->error = xmlGenericError;
cvp->warning = (xmlValidityWarningFunc) fprintf; cvp->warning = xmlGenericError;
if ((timing) && (!repeat)) { if ((timing) && (!repeat)) {
startTimer(); startTimer();
@ -2796,9 +2793,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if ((timing) && (!repeat)) { if ((timing) && (!repeat)) {
startTimer(); startTimer();
} }
cvp->userData = (void *) stderr; cvp->userData = NULL;
cvp->error = (xmlValidityErrorFunc) fprintf; cvp->error = xmlGenericError;
cvp->warning = (xmlValidityWarningFunc) fprintf; cvp->warning = xmlGenericError;
if (!xmlValidateDocument(cvp, doc)) { if (!xmlValidateDocument(cvp, doc)) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Document %s does not validate\n", filename); "Document %s does not validate\n", filename);
@ -2828,10 +2825,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
flag |= XML_SCHEMATRON_OUT_QUIET; flag |= XML_SCHEMATRON_OUT_QUIET;
ctxt = xmlSchematronNewValidCtxt(wxschematron, flag); ctxt = xmlSchematronNewValidCtxt(wxschematron, flag);
#if 0 #if 0
xmlSchematronSetValidErrors(ctxt, xmlSchematronSetValidErrors(ctxt, xmlGenericError, xmlGenericError,
(xmlSchematronValidityErrorFunc) fprintf, NULL);
(xmlSchematronValidityWarningFunc) fprintf,
stderr);
#endif #endif
ret = xmlSchematronValidateDoc(ctxt, doc); ret = xmlSchematronValidateDoc(ctxt, doc);
if (ret == 0) { if (ret == 0) {
@ -2860,10 +2855,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
} }
ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas); ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas);
xmlRelaxNGSetValidErrors(ctxt, xmlRelaxNGSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
(xmlRelaxNGValidityErrorFunc) fprintf,
(xmlRelaxNGValidityWarningFunc) fprintf,
stderr);
ret = xmlRelaxNGValidateDoc(ctxt, doc); ret = xmlRelaxNGValidateDoc(ctxt, doc);
if (ret == 0) { if (ret == 0) {
fprintf(stderr, "%s validates\n", filename); fprintf(stderr, "%s validates\n", filename);
@ -2888,10 +2880,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
} }
ctxt = xmlSchemaNewValidCtxt(wxschemas); ctxt = xmlSchemaNewValidCtxt(wxschemas);
xmlSchemaSetValidErrors(ctxt, xmlSchemaSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
(xmlSchemaValidityErrorFunc) fprintf,
(xmlSchemaValidityWarningFunc) fprintf,
stderr);
ret = xmlSchemaValidateDoc(ctxt, doc); ret = xmlSchemaValidateDoc(ctxt, doc);
if (ret == 0) { if (ret == 0) {
fprintf(stderr, "%s validates\n", filename); fprintf(stderr, "%s validates\n", filename);
@ -3069,10 +3058,10 @@ static void usage(FILE *f, const char *name) {
#ifdef LIBXML_READER_ENABLED #ifdef LIBXML_READER_ENABLED
fprintf(f, "\t--stream : use the streaming interface to process very large files\n"); fprintf(f, "\t--stream : use the streaming interface to process very large files\n");
fprintf(f, "\t--walker : create a reader and walk though the resulting doc\n"); fprintf(f, "\t--walker : create a reader and walk though the resulting doc\n");
#endif /* LIBXML_READER_ENABLED */
#ifdef LIBXML_PATTERN_ENABLED #ifdef LIBXML_PATTERN_ENABLED
fprintf(f, "\t--pattern pattern_value : test the pattern support\n"); fprintf(f, "\t--pattern pattern_value : test the pattern support\n");
#endif #endif
#endif /* LIBXML_READER_ENABLED */
fprintf(f, "\t--chkregister : verify the node registration code\n"); fprintf(f, "\t--chkregister : verify the node registration code\n");
#ifdef LIBXML_SCHEMAS_ENABLED #ifdef LIBXML_SCHEMAS_ENABLED
fprintf(f, "\t--relaxng schema : do RelaxNG validation against the schema\n"); fprintf(f, "\t--relaxng schema : do RelaxNG validation against the schema\n");
@ -3404,6 +3393,12 @@ main(int argc, char **argv) {
(!strcmp(argv[i], "--walker"))) { (!strcmp(argv[i], "--walker"))) {
walker++; walker++;
noout++; noout++;
#ifdef LIBXML_PATTERN_ENABLED
} else if ((!strcmp(argv[i], "-pattern")) ||
(!strcmp(argv[i], "--pattern"))) {
i++;
pattern = argv[i];
#endif
} }
#endif /* LIBXML_READER_ENABLED */ #endif /* LIBXML_READER_ENABLED */
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
@ -3454,12 +3449,6 @@ main(int argc, char **argv) {
(!strcmp(argv[i], "--path"))) { (!strcmp(argv[i], "--path"))) {
i++; i++;
parsePath(BAD_CAST argv[i]); parsePath(BAD_CAST argv[i]);
#ifdef LIBXML_PATTERN_ENABLED
} else if ((!strcmp(argv[i], "-pattern")) ||
(!strcmp(argv[i], "--pattern"))) {
i++;
pattern = argv[i];
#endif
#ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_XPATH_ENABLED
} else if ((!strcmp(argv[i], "-xpath")) || } else if ((!strcmp(argv[i], "-xpath")) ||
(!strcmp(argv[i], "--xpath"))) { (!strcmp(argv[i], "--xpath"))) {
@ -3552,10 +3541,8 @@ main(int argc, char **argv) {
} }
ctxt = xmlSchematronNewParserCtxt(schematron); ctxt = xmlSchematronNewParserCtxt(schematron);
#if 0 #if 0
xmlSchematronSetParserErrors(ctxt, xmlSchematronSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
(xmlSchematronValidityErrorFunc) fprintf, NULL);
(xmlSchematronValidityWarningFunc) fprintf,
stderr);
#endif #endif
wxschematron = xmlSchematronParse(ctxt); wxschematron = xmlSchematronParse(ctxt);
if (wxschematron == NULL) { if (wxschematron == NULL) {
@ -3585,10 +3572,8 @@ main(int argc, char **argv) {
startTimer(); startTimer();
} }
ctxt = xmlRelaxNGNewParserCtxt(relaxng); ctxt = xmlRelaxNGNewParserCtxt(relaxng);
xmlRelaxNGSetParserErrors(ctxt, xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
(xmlRelaxNGValidityErrorFunc) fprintf, NULL);
(xmlRelaxNGValidityWarningFunc) fprintf,
stderr);
relaxngschemas = xmlRelaxNGParse(ctxt); relaxngschemas = xmlRelaxNGParse(ctxt);
if (relaxngschemas == NULL) { if (relaxngschemas == NULL) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
@ -3611,10 +3596,7 @@ main(int argc, char **argv) {
startTimer(); startTimer();
} }
ctxt = xmlSchemaNewParserCtxt(schema); ctxt = xmlSchemaNewParserCtxt(schema);
xmlSchemaSetParserErrors(ctxt, xmlSchemaSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
(xmlSchemaValidityErrorFunc) fprintf,
(xmlSchemaValidityWarningFunc) fprintf,
stderr);
wxschemas = xmlSchemaParse(ctxt); wxschemas = xmlSchemaParse(ctxt);
if (wxschemas == NULL) { if (wxschemas == NULL) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
@ -3628,12 +3610,8 @@ main(int argc, char **argv) {
} }
} }
#endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_PATTERN_ENABLED #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
if ((pattern != NULL) if ((pattern != NULL) && (walker == 0)) {
#ifdef LIBXML_READER_ENABLED
&& (walker == 0)
#endif
) {
patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL); patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL);
if (patternc == NULL) { if (patternc == NULL) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
@ -3642,7 +3620,7 @@ main(int argc, char **argv) {
pattern = NULL; pattern = NULL;
} }
} }
#endif /* LIBXML_PATTERN_ENABLED */ #endif /* LIBXML_READER_ENABLED && LIBXML_PATTERN_ENABLED */
for (i = 1; i < argc ; i++) { for (i = 1; i < argc ; i++) {
if ((!strcmp(argv[i], "-encode")) || if ((!strcmp(argv[i], "-encode")) ||
(!strcmp(argv[i], "--encode"))) { (!strcmp(argv[i], "--encode"))) {
@ -3696,7 +3674,7 @@ main(int argc, char **argv) {
i++; i++;
continue; continue;
} }
#ifdef LIBXML_PATTERN_ENABLED #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
if ((!strcmp(argv[i], "-pattern")) || if ((!strcmp(argv[i], "-pattern")) ||
(!strcmp(argv[i], "--pattern"))) { (!strcmp(argv[i], "--pattern"))) {
i++; i++;
@ -3780,7 +3758,7 @@ main(int argc, char **argv) {
xmlSchemaFree(wxschemas); xmlSchemaFree(wxschemas);
xmlRelaxNGCleanupTypes(); xmlRelaxNGCleanupTypes();
#endif #endif
#ifdef LIBXML_PATTERN_ENABLED #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
if (patternc != NULL) if (patternc != NULL)
xmlFreePattern(patternc); xmlFreePattern(patternc);
#endif #endif

View file

@ -67,7 +67,7 @@ xmlModuleErrMemory(xmlModulePtr module, const char *extra)
* *
* Opens a module/shared library given its name or path * Opens a module/shared library given its name or path
* NOTE: that due to portability issues, behaviour can only be * NOTE: that due to portability issues, behaviour can only be
* guaranteed with @name using ASCII. We canot guarantee that * guaranteed with @name using ASCII. We cannot guarantee that
* an UTF-8 string would work, which is why name is a const char * * an UTF-8 string would work, which is why name is a const char *
* and not a const xmlChar * . * and not a const xmlChar * .
* TODO: options are not yet implemented. * TODO: options are not yet implemented.
@ -109,7 +109,7 @@ xmlModuleOpen(const char *name, int options ATTRIBUTE_UNUSED)
* *
* Lookup for a symbol address in the given module * Lookup for a symbol address in the given module
* NOTE: that due to portability issues, behaviour can only be * NOTE: that due to portability issues, behaviour can only be
* guaranteed with @name using ASCII. We canot guarantee that * guaranteed with @name using ASCII. We cannot guarantee that
* an UTF-8 string would work, which is why name is a const char * * an UTF-8 string would work, which is why name is a const char *
* and not a const xmlChar * . * and not a const xmlChar * .
* *

View file

@ -238,6 +238,8 @@ xmlFreeID(xmlIDPtr id) {
if (id->value != NULL) if (id->value != NULL)
DICT_FREE(id->value) DICT_FREE(id->value)
if (id->name != NULL)
DICT_FREE(id->name)
xmlFree(id); xmlFree(id);
} }
@ -271,6 +273,7 @@ xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
return(-1); return(-1);
} }
id->name = attr->name; id->name = attr->name;
attr->name = NULL;
id->attr = NULL; id->attr = NULL;
return(0); return(0);
} }
@ -345,7 +348,9 @@ xmlTextReaderFreePropList(xmlTextReaderPtr reader, xmlAttrPtr cur) {
static void static void
xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) { xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) {
xmlNodePtr next; xmlNodePtr next;
xmlNodePtr parent;
xmlDictPtr dict; xmlDictPtr dict;
size_t depth = 0;
if ((reader != NULL) && (reader->ctxt != NULL)) if ((reader != NULL) && (reader->ctxt != NULL))
dict = reader->ctxt->dict; dict = reader->ctxt->dict;
@ -361,18 +366,21 @@ xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) {
xmlFreeDoc((xmlDocPtr) cur); xmlFreeDoc((xmlDocPtr) cur);
return; return;
} }
while (cur != NULL) { while (1) {
while ((cur->type != XML_DTD_NODE) &&
(cur->type != XML_ENTITY_REF_NODE) &&
(cur->children != NULL) &&
(cur->children->parent == cur)) {
cur = cur->children;
depth += 1;
}
next = cur->next; next = cur->next;
parent = cur->parent;
/* unroll to speed up freeing the document */ /* unroll to speed up freeing the document */
if (cur->type != XML_DTD_NODE) { if (cur->type != XML_DTD_NODE) {
if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE)) {
if (cur->children->parent == cur)
xmlTextReaderFreeNodeList(reader, cur->children);
cur->children = NULL;
}
if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
xmlDeregisterNodeDefaultValue(cur); xmlDeregisterNodeDefaultValue(cur);
@ -411,7 +419,16 @@ xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) {
xmlFree(cur); xmlFree(cur);
} }
} }
cur = next;
if (next != NULL) {
cur = next;
} else {
if ((depth == 0) || (parent == NULL))
break;
depth -= 1;
cur = parent;
cur->children = NULL;
}
} }
} }
@ -983,7 +1000,6 @@ xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
*/ */
node = xmlTextReaderExpand(reader); node = xmlTextReaderExpand(reader);
if (node == NULL) { if (node == NULL) {
printf("Expand failed !\n");
ret = -1; ret = -1;
} else { } else {
ret = xmlRelaxNGValidateFullElement(reader->rngValidCtxt, ret = xmlRelaxNGValidateFullElement(reader->rngValidCtxt,
@ -1095,7 +1111,7 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
do { do {
if (node->type == XML_ENTITY_REF_NODE) { if (node->type == XML_ENTITY_REF_NODE) {
/* /*
* Case where the underlying tree is not availble, lookup the entity * Case where the underlying tree is not available, lookup the entity
* and walk it. * and walk it.
*/ */
if ((node->children == NULL) && (ctxt->sax != NULL) && if ((node->children == NULL) && (ctxt->sax != NULL) &&
@ -1112,11 +1128,11 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
continue; continue;
} else { } else {
/* /*
* The error has probably be raised already. * The error has probably been raised already.
*/ */
if (node == oldnode) if (node == oldnode)
break; break;
node = node->next; goto skip_children;
} }
#ifdef LIBXML_REGEXP_ENABLED #ifdef LIBXML_REGEXP_ENABLED
} else if (node->type == XML_ELEMENT_NODE) { } else if (node->type == XML_ELEMENT_NODE) {
@ -1138,6 +1154,7 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
} else if (node->type == XML_ELEMENT_NODE) { } else if (node->type == XML_ELEMENT_NODE) {
xmlTextReaderValidatePop(reader); xmlTextReaderValidatePop(reader);
} }
skip_children:
if (node->next != NULL) { if (node->next != NULL) {
node = node->next; node = node->next;
continue; continue;
@ -1357,7 +1374,7 @@ get_next_node:
/* /*
* If we are not backtracking on ancestors or examined nodes, * If we are not backtracking on ancestors or examined nodes,
* that the parser didn't finished or that we arent at the end * that the parser didn't finished or that we aren't at the end
* of stream, continue processing. * of stream, continue processing.
*/ */
while ((reader->node != NULL) && (reader->node->next == NULL) && while ((reader->node != NULL) && (reader->node->next == NULL) &&
@ -1548,7 +1565,7 @@ node_found:
(reader->node->type == XML_ENTITY_REF_NODE) && (reader->node->type == XML_ENTITY_REF_NODE) &&
(reader->ctxt != NULL) && (reader->ctxt->replaceEntities == 1)) { (reader->ctxt != NULL) && (reader->ctxt->replaceEntities == 1)) {
/* /*
* Case where the underlying tree is not availble, lookup the entity * Case where the underlying tree is not available, lookup the entity
* and walk it. * and walk it.
*/ */
if ((reader->node->children == NULL) && (reader->ctxt->sax != NULL) && if ((reader->node->children == NULL) && (reader->ctxt->sax != NULL) &&
@ -1713,6 +1730,8 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
} }
doc = reader->node->doc; doc = reader->node->doc;
buff = xmlBufferCreate(); buff = xmlBufferCreate();
if (buff == NULL)
return NULL;
for (cur_node = reader->node->children; cur_node != NULL; for (cur_node = reader->node->children; cur_node != NULL;
cur_node = cur_node->next) { cur_node = cur_node->next) {
/* XXX: Why is the node copied? */ /* XXX: Why is the node copied? */
@ -1755,11 +1774,11 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
xmlBufferPtr buff; xmlBufferPtr buff;
xmlDocPtr doc; xmlDocPtr doc;
node = reader->node;
doc = node->doc;
if (xmlTextReaderExpand(reader) == NULL) { if (xmlTextReaderExpand(reader) == NULL) {
return NULL; return NULL;
} }
node = reader->node;
doc = node->doc;
/* XXX: Why is the node copied? */ /* XXX: Why is the node copied? */
if (node->type == XML_DTD_NODE) { if (node->type == XML_DTD_NODE) {
node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node); node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node);
@ -2262,17 +2281,19 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
if (reader->ctxt != NULL) { if (reader->ctxt != NULL) {
if (reader->dict == reader->ctxt->dict) if (reader->dict == reader->ctxt->dict)
reader->dict = NULL; reader->dict = NULL;
if ((reader->ctxt->vctxt.vstateTab != NULL) &&
(reader->ctxt->vctxt.vstateMax > 0)){
while (reader->ctxt->vctxt.vstateNr > 0)
xmlValidatePopElement(&reader->ctxt->vctxt, NULL, NULL, NULL);
xmlFree(reader->ctxt->vctxt.vstateTab);
reader->ctxt->vctxt.vstateTab = NULL;
reader->ctxt->vctxt.vstateMax = 0;
}
if (reader->ctxt->myDoc != NULL) { if (reader->ctxt->myDoc != NULL) {
if (reader->preserve == 0) if (reader->preserve == 0)
xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
reader->ctxt->myDoc = NULL; reader->ctxt->myDoc = NULL;
} }
if ((reader->ctxt->vctxt.vstateTab != NULL) &&
(reader->ctxt->vctxt.vstateMax > 0)){
xmlFree(reader->ctxt->vctxt.vstateTab);
reader->ctxt->vctxt.vstateTab = NULL;
reader->ctxt->vctxt.vstateMax = 0;
}
if (reader->allocs & XML_TEXTREADER_CTXT) if (reader->allocs & XML_TEXTREADER_CTXT)
xmlFreeParserCtxt(reader->ctxt); xmlFreeParserCtxt(reader->ctxt);
} }
@ -2500,7 +2521,7 @@ xmlTextReaderGetAttributeNs(xmlTextReaderPtr reader, const xmlChar *localName,
* parser, set its state to End Of File and return the input stream with * parser, set its state to End Of File and return the input stream with
* what is left that the parser did not use. * what is left that the parser did not use.
* *
* The implementation is not good, the parser certainly procgressed past * The implementation is not good, the parser certainly progressed past
* what's left in reader->input, and there is an allocation problem. Best * what's left in reader->input, and there is an allocation problem. Best
* would be to rewrite it differently. * would be to rewrite it differently.
* *
@ -2882,8 +2903,8 @@ xmlTextReaderMoveToElement(xmlTextReaderPtr reader) {
* *
* Parses an attribute value into one or more Text and EntityReference nodes. * Parses an attribute value into one or more Text and EntityReference nodes.
* *
* Returns 1 in case of success, 0 if the reader was not positionned on an * Returns 1 in case of success, 0 if the reader was not positioned on an
* ttribute node or all the attribute values have been read, or -1 * attribute node or all the attribute values have been read, or -1
* in case of error. * in case of error.
*/ */
int int
@ -3920,7 +3941,7 @@ xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader)
* xmlTextReaderCurrentNode: * xmlTextReaderCurrentNode:
* @reader: the xmlTextReaderPtr used * @reader: the xmlTextReaderPtr used
* *
* Hacking interface allowing to get the xmlNodePtr correponding to the * Hacking interface allowing to get the xmlNodePtr corresponding to the
* current node being accessed by the xmlTextReader. This is dangerous * current node being accessed by the xmlTextReader. This is dangerous
* because the underlying node may be destroyed on the next Reads. * because the underlying node may be destroyed on the next Reads.
* *
@ -4032,7 +4053,7 @@ xmlTextReaderPreservePattern(xmlTextReaderPtr reader, const xmlChar *pattern,
* xmlTextReaderCurrentDoc: * xmlTextReaderCurrentDoc:
* @reader: the xmlTextReaderPtr used * @reader: the xmlTextReaderPtr used
* *
* Hacking interface allowing to get the xmlDocPtr correponding to the * Hacking interface allowing to get the xmlDocPtr corresponding to the
* current document being accessed by the xmlTextReader. * current document being accessed by the xmlTextReader.
* NOTE: as a result of this call, the reader will not destroy the * NOTE: as a result of this call, the reader will not destroy the
* associated XML document and calling xmlFreeDoc() on the result * associated XML document and calling xmlFreeDoc() on the result
@ -4135,11 +4156,11 @@ xmlTextReaderValidityStructuredRelay(void *userData, xmlErrorPtr error)
* *
* Use RelaxNG to validate the document as it is processed. * Use RelaxNG to validate the document as it is processed.
* Activation is only possible before the first Read(). * Activation is only possible before the first Read().
* if @schema is NULL, then RelaxNG validation is desactivated. * if @schema is NULL, then RelaxNG validation is deactivated.
@ The @schema should not be freed until the reader is deallocated @ The @schema should not be freed until the reader is deallocated
* or its use has been deactivated. * or its use has been deactivated.
* *
* Returns 0 in case the RelaxNG validation could be (des)activated and * Returns 0 in case the RelaxNG validation could be (de)activated and
* -1 in case of error. * -1 in case of error.
*/ */
int int
@ -4199,7 +4220,7 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) {
* *
* Internal locator function for the readers * Internal locator function for the readers
* *
* Returns 0 in case the Schema validation could be (des)activated and * Returns 0 in case the Schema validation could be (de)activated and
* -1 in case of error. * -1 in case of error.
*/ */
static int static int
@ -4252,11 +4273,11 @@ xmlTextReaderLocator(void *ctx, const char **file, unsigned long *line) {
* *
* Use XSD Schema to validate the document as it is processed. * Use XSD Schema to validate the document as it is processed.
* Activation is only possible before the first Read(). * Activation is only possible before the first Read().
* if @schema is NULL, then Schema validation is desactivated. * if @schema is NULL, then Schema validation is deactivated.
@ The @schema should not be freed until the reader is deallocated * The @schema should not be freed until the reader is deallocated
* or its use has been deactivated. * or its use has been deactivated.
* *
* Returns 0 in case the Schema validation could be (des)activated and * Returns 0 in case the Schema validation could be (de)activated and
* -1 in case of error. * -1 in case of error.
*/ */
int int

View file

@ -2,7 +2,7 @@
* regexp.c: generic and extensible Regular Expression engine * regexp.c: generic and extensible Regular Expression engine
* *
* Basically designed with the purpose of compiling regexps for * Basically designed with the purpose of compiling regexps for
* the variety of validation/shemas mechanisms now available in * the variety of validation/schemas mechanisms now available in
* XML related specifications these include: * XML related specifications these include:
* - XML-1.0 DTD validation * - XML-1.0 DTD validation
* - XML Schemas structure part 1 * - XML Schemas structure part 1
@ -228,7 +228,7 @@ struct _xmlAutomataState {
int maxTrans; int maxTrans;
int nbTrans; int nbTrans;
xmlRegTrans *trans; xmlRegTrans *trans;
/* knowing states ponting to us can speed things up */ /* knowing states pointing to us can speed things up */
int maxTransTo; int maxTransTo;
int nbTransTo; int nbTransTo;
int *transTo; int *transTo;
@ -545,6 +545,8 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
if (transitions == NULL) { if (transitions == NULL) {
xmlFree(stateRemap); xmlFree(stateRemap);
xmlFree(stringRemap); xmlFree(stringRemap);
for (i = 0;i < nbatoms;i++)
xmlFree(stringMap[i]);
xmlFree(stringMap); xmlFree(stringMap);
xmlFree(ret); xmlFree(ret);
return(NULL); return(NULL);
@ -588,7 +590,7 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
targetno = stateRemap[trans->to]; targetno = stateRemap[trans->to];
/* /*
* if the same atom can generate transitions to 2 different * if the same atom can generate transitions to 2 different
* states then it means the automata is not determinist and * states then it means the automata is not deterministic and
* the compact form can't be used ! * the compact form can't be used !
*/ */
prev = transitions[stateno * (nbatoms + 1) + atomno + 1]; prev = transitions[stateno * (nbatoms + 1) + atomno + 1];
@ -829,7 +831,7 @@ xmlRegFreeAtom(xmlRegAtomPtr atom) {
/** /**
* xmlRegCopyAtom: * xmlRegCopyAtom:
* @ctxt: the regexp parser context * @ctxt: the regexp parser context
* @atom: the oiginal atom * @atom: the original atom
* *
* Allocate a new regexp range * Allocate a new regexp range
* *
@ -1547,7 +1549,7 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
int nullable = 0; int nullable = 0;
if (atom == NULL) { if (atom == NULL) {
ERROR("genrate transition: atom == NULL"); ERROR("generate transition: atom == NULL");
return(-1); return(-1);
} }
if (atom->type == XML_REGEXP_SUBREG) { if (atom->type == XML_REGEXP_SUBREG) {
@ -1622,7 +1624,7 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
xmlRegAtomPtr copy; xmlRegAtomPtr copy;
/* /*
* duplicate a transition based on atom to count next * duplicate a transition based on atom to count next
* occurences after 1. We cannot loop to atom->start * occurrences after 1. We cannot loop to atom->start
* directly because we need an epsilon transition to * directly because we need an epsilon transition to
* newstate. * newstate.
*/ */
@ -1655,7 +1657,7 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
} else { } else {
/* /*
* either we need the atom at least once or there * either we need the atom at least once or there
* is an atom->start0 allowing to easilly plug the * is an atom->start0 allowing to easily plug the
* epsilon transition. * epsilon transition.
*/ */
counter = xmlRegGetCounter(ctxt); counter = xmlRegGetCounter(ctxt);
@ -1955,7 +1957,7 @@ xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) {
* Build the completed transitions bypassing the epsilons * Build the completed transitions bypassing the epsilons
* Use a marking algorithm to avoid loops * Use a marking algorithm to avoid loops
* Mark sink states too. * Mark sink states too.
* Process from the latests states backward to the start when * Process from the latest states backward to the start when
* there is long cascading epsilon chains this minimize the * there is long cascading epsilon chains this minimize the
* recursions and transition compares when adding the new ones * recursions and transition compares when adding the new ones
*/ */
@ -2143,7 +2145,7 @@ xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) {
} else { } else {
/* /*
* comparing a block range with anything else is way * comparing a block range with anything else is way
* too costly, and maintining the table is like too much * too costly, and maintaining the table is like too much
* memory too, so let's force the automata to save state * memory too, so let's force the automata to save state
* here. * here.
*/ */
@ -2277,7 +2279,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
} }
switch (type1) { switch (type1) {
case XML_REGEXP_ANYSPACE: /* \s */ case XML_REGEXP_ANYSPACE: /* \s */
/* can't be a letter, number, mark, pontuation, symbol */ /* can't be a letter, number, mark, punctuation, symbol */
if ((type2 == XML_REGEXP_NOTSPACE) || if ((type2 == XML_REGEXP_NOTSPACE) ||
((type2 >= XML_REGEXP_LETTER) && ((type2 >= XML_REGEXP_LETTER) &&
(type2 <= XML_REGEXP_LETTER_OTHERS)) || (type2 <= XML_REGEXP_LETTER_OTHERS)) ||
@ -2294,7 +2296,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
case XML_REGEXP_NOTSPACE: /* \S */ case XML_REGEXP_NOTSPACE: /* \S */
break; break;
case XML_REGEXP_INITNAME: /* \l */ case XML_REGEXP_INITNAME: /* \l */
/* can't be a number, mark, separator, pontuation, symbol or other */ /* can't be a number, mark, separator, punctuation, symbol or other */
if ((type2 == XML_REGEXP_NOTINITNAME) || if ((type2 == XML_REGEXP_NOTINITNAME) ||
((type2 >= XML_REGEXP_NUMBER) && ((type2 >= XML_REGEXP_NUMBER) &&
(type2 <= XML_REGEXP_NUMBER_OTHERS)) || (type2 <= XML_REGEXP_NUMBER_OTHERS)) ||
@ -2313,7 +2315,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
case XML_REGEXP_NOTINITNAME: /* \L */ case XML_REGEXP_NOTINITNAME: /* \L */
break; break;
case XML_REGEXP_NAMECHAR: /* \c */ case XML_REGEXP_NAMECHAR: /* \c */
/* can't be a mark, separator, pontuation, symbol or other */ /* can't be a mark, separator, punctuation, symbol or other */
if ((type2 == XML_REGEXP_NOTNAMECHAR) || if ((type2 == XML_REGEXP_NOTNAMECHAR) ||
((type2 >= XML_REGEXP_MARK) && ((type2 >= XML_REGEXP_MARK) &&
(type2 <= XML_REGEXP_MARK_ENCLOSING)) || (type2 <= XML_REGEXP_MARK_ENCLOSING)) ||
@ -2330,7 +2332,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
case XML_REGEXP_NOTNAMECHAR: /* \C */ case XML_REGEXP_NOTNAMECHAR: /* \C */
break; break;
case XML_REGEXP_DECIMAL: /* \d */ case XML_REGEXP_DECIMAL: /* \d */
/* can't be a letter, mark, separator, pontuation, symbol or other */ /* can't be a letter, mark, separator, punctuation, symbol or other */
if ((type2 == XML_REGEXP_NOTDECIMAL) || if ((type2 == XML_REGEXP_NOTDECIMAL) ||
(type2 == XML_REGEXP_REALCHAR) || (type2 == XML_REGEXP_REALCHAR) ||
((type2 >= XML_REGEXP_LETTER) && ((type2 >= XML_REGEXP_LETTER) &&
@ -2350,7 +2352,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
case XML_REGEXP_NOTDECIMAL: /* \D */ case XML_REGEXP_NOTDECIMAL: /* \D */
break; break;
case XML_REGEXP_REALCHAR: /* \w */ case XML_REGEXP_REALCHAR: /* \w */
/* can't be a mark, separator, pontuation, symbol or other */ /* can't be a mark, separator, punctuation, symbol or other */
if ((type2 == XML_REGEXP_NOTDECIMAL) || if ((type2 == XML_REGEXP_NOTDECIMAL) ||
((type2 >= XML_REGEXP_MARK) && ((type2 >= XML_REGEXP_MARK) &&
(type2 <= XML_REGEXP_MARK_ENCLOSING)) || (type2 <= XML_REGEXP_MARK_ENCLOSING)) ||
@ -2526,9 +2528,18 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) {
case XML_REGEXP_STRING: case XML_REGEXP_STRING:
if (!deep) if (!deep)
ret = (atom1->valuep != atom2->valuep); ret = (atom1->valuep != atom2->valuep);
else else {
ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep, xmlChar *val1 = (xmlChar *)atom1->valuep;
(xmlChar *)atom2->valuep); xmlChar *val2 = (xmlChar *)atom2->valuep;
int compound1 = (xmlStrchr(val1, '|') != NULL);
int compound2 = (xmlStrchr(val2, '|') != NULL);
/* Ignore negative match flag for ##other namespaces */
if (compound1 != compound2)
return(0);
ret = xmlRegStrEqualWildcard(val1, val2);
}
break; break;
case XML_REGEXP_EPSILON: case XML_REGEXP_EPSILON:
goto not_determinist; goto not_determinist;
@ -3564,9 +3575,9 @@ xmlRegNewExecCtxt(xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data) {
/** /**
* xmlRegFreeExecCtxt: * xmlRegFreeExecCtxt:
* @exec: a regular expression evaulation context * @exec: a regular expression evaluation context
* *
* Free the structures associated to a regular expression evaulation context. * Free the structures associated to a regular expression evaluation context.
*/ */
void void
xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) { xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) {
@ -3640,7 +3651,7 @@ xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value,
* @valStr: the validation string * @valStr: the validation string
* *
* Checks if both strings are equal or have the same content. "*" * Checks if both strings are equal or have the same content. "*"
* can be used as a wildcard in @valStr; "|" is used as a seperator of * can be used as a wildcard in @valStr; "|" is used as a separator of
* substrings in both @expStr and @valStr. * substrings in both @expStr and @valStr.
* *
* Returns 1 if the comparison is satisfied and the number of substrings * Returns 1 if the comparison is satisfied and the number of substrings
@ -5347,9 +5358,12 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) {
previous = ctxt->state; previous = ctxt->state;
ret = xmlFAParsePiece(ctxt); ret = xmlFAParsePiece(ctxt);
if (ret != 0) { if (ret == 0) {
/* Empty branch */
xmlFAGenerateEpsilonTransition(ctxt, previous, to);
} else {
if (xmlFAGenerateTransitions(ctxt, previous, if (xmlFAGenerateTransitions(ctxt, previous,
(CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) (CUR=='|' || CUR==')' || CUR==0) ? to : NULL, ctxt->atom) < 0)
return(-1); return(-1);
previous = ctxt->state; previous = ctxt->state;
ctxt->atom = NULL; ctxt->atom = NULL;
@ -5358,7 +5372,8 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) {
ret = xmlFAParsePiece(ctxt); ret = xmlFAParsePiece(ctxt);
if (ret != 0) { if (ret != 0) {
if (xmlFAGenerateTransitions(ctxt, previous, if (xmlFAGenerateTransitions(ctxt, previous,
(CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) (CUR=='|' || CUR==')' || CUR==0) ? to : NULL,
ctxt->atom) < 0)
return(-1); return(-1);
previous = ctxt->state; previous = ctxt->state;
ctxt->atom = NULL; ctxt->atom = NULL;
@ -5395,10 +5410,6 @@ xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top) {
end = ctxt->state; end = ctxt->state;
while ((CUR == '|') && (ctxt->error == 0)) { while ((CUR == '|') && (ctxt->error == 0)) {
NEXT; NEXT;
if (CUR == 0) {
ERROR("expecting a branch after |")
return;
}
ctxt->state = start; ctxt->state = start;
ctxt->end = NULL; ctxt->end = NULL;
xmlFAParseBranch(ctxt, end); xmlFAParseBranch(ctxt, end);
@ -5537,6 +5548,8 @@ xmlRegexpIsDeterminist(xmlRegexpPtr comp) {
return(comp->determinist); return(comp->determinist);
am = xmlNewAutomata(); am = xmlNewAutomata();
if (am == NULL)
return(-1);
if (am->states != NULL) { if (am->states != NULL) {
int i; int i;
@ -5864,8 +5877,8 @@ xmlAutomataNewNegTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
* @to: the target point of the transition or NULL * @to: the target point of the transition or NULL
* @token: the input string associated to that transition * @token: the input string associated to that transition
* @token2: the second input string associated to that transition * @token2: the second input string associated to that transition
* @min: the minimum successive occurences of token * @min: the minimum successive occurrences of token
* @max: the maximum successive occurences of token * @max: the maximum successive occurrences of token
* @data: data associated to the transition * @data: data associated to the transition
* *
* If @to is NULL, this creates first a new target state in the automata * If @to is NULL, this creates first a new target state in the automata
@ -5951,8 +5964,8 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
* @from: the starting point of the transition * @from: the starting point of the transition
* @to: the target point of the transition or NULL * @to: the target point of the transition or NULL
* @token: the input string associated to that transition * @token: the input string associated to that transition
* @min: the minimum successive occurences of token * @min: the minimum successive occurrences of token
* @max: the maximum successive occurences of token * @max: the maximum successive occurrences of token
* @data: data associated to the transition * @data: data associated to the transition
* *
* If @to is NULL, this creates first a new target state in the automata * If @to is NULL, this creates first a new target state in the automata
@ -6018,8 +6031,8 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
* @to: the target point of the transition or NULL * @to: the target point of the transition or NULL
* @token: the input string associated to that transition * @token: the input string associated to that transition
* @token2: the second input string associated to that transition * @token2: the second input string associated to that transition
* @min: the minimum successive occurences of token * @min: the minimum successive occurrences of token
* @max: the maximum successive occurences of token * @max: the maximum successive occurrences of token
* @data: data associated to the transition * @data: data associated to the transition
* *
* If @to is NULL, this creates first a new target state in the automata * If @to is NULL, this creates first a new target state in the automata
@ -6098,8 +6111,8 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
* @from: the starting point of the transition * @from: the starting point of the transition
* @to: the target point of the transition or NULL * @to: the target point of the transition or NULL
* @token: the input string associated to that transition * @token: the input string associated to that transition
* @min: the minimum successive occurences of token * @min: the minimum successive occurrences of token
* @max: the maximum successive occurences of token * @max: the maximum successive occurrences of token
* @data: data associated to the transition * @data: data associated to the transition
* *
* If @to is NULL, this creates first a new target state in the automata * If @to is NULL, this creates first a new target state in the automata
@ -6616,7 +6629,7 @@ xmlExpHashGetEntry(xmlExpCtxtPtr ctxt, xmlExpNodeType type,
/* OR reduction rule 1 */ /* OR reduction rule 1 */
/* a | a reduced to a */ /* a | a reduced to a */
if (left == right) { if (left == right) {
left->ref--; xmlExpFree(ctxt, right);
return(left); return(left);
} }
/* OR canonicalization rule 1 */ /* OR canonicalization rule 1 */
@ -7075,7 +7088,7 @@ xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
* xmlExpIsNillable: * xmlExpIsNillable:
* @exp: the expression * @exp: the expression
* *
* Finds if the expression is nillable, i.e. if it accepts the empty sequqnce * Finds if the expression is nillable, i.e. if it accepts the empty sequence
* *
* Returns 1 if nillable, 0 if not and -1 in case of error * Returns 1 if nillable, 0 if not and -1 in case of error
*/ */
@ -7258,7 +7271,7 @@ static xmlExpNodePtr xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
* so that sub{n} subsume exp * so that sub{n} subsume exp
* *
* Returns the multiple value if successful, 0 if it is not a multiple * Returns the multiple value if successful, 0 if it is not a multiple
* and -1 in case of internel error. * and -1 in case of internal error.
*/ */
static int static int
@ -7426,7 +7439,7 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
return(forbiddenExp); return(forbiddenExp);
} }
#ifdef DEBUG_DERIV #ifdef DEBUG_DERIV
printf("Compex exp vs Atom -> Forbid\n"); printf("Complex exp vs Atom -> Forbid\n");
#endif #endif
return(forbiddenExp); return(forbiddenExp);
case XML_EXP_SEQ: case XML_EXP_SEQ:
@ -7770,7 +7783,7 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
* *
* Evaluates the expression resulting from @exp consuming a sub expression @sub * Evaluates the expression resulting from @exp consuming a sub expression @sub
* Based on algebraic derivation and sometimes direct Brzozowski derivation * Based on algebraic derivation and sometimes direct Brzozowski derivation
* it usually tatkes less than linear time and can handle expressions generating * it usually takes less than linear time and can handle expressions generating
* infinite languages. * infinite languages.
* *
* Returns the resulting expression or NULL in case of internal error, the * Returns the resulting expression or NULL in case of internal error, the
@ -7792,7 +7805,7 @@ xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
} }
if (xmlExpCheckCard(exp, sub) == 0) { if (xmlExpCheckCard(exp, sub) == 0) {
#ifdef DEBUG_DERIV #ifdef DEBUG_DERIV
printf("sub generate longuer sequances than exp : can't subsume\n"); printf("sub generate longer sequences than exp : can't subsume\n");
#endif #endif
return(forbiddenExp); return(forbiddenExp);
} }
@ -7805,7 +7818,7 @@ xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
* @exp: the englobing expression * @exp: the englobing expression
* @sub: the subexpression * @sub: the subexpression
* *
* Check whether @exp accepts all the languages accexpted by @sub * Check whether @exp accepts all the languages accepted by @sub
* the input being a subexpression. * the input being a subexpression.
* *
* Returns 1 if true 0 if false and -1 in case of failure. * Returns 1 if true 0 if false and -1 in case of failure.
@ -7832,7 +7845,7 @@ xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
} }
if (xmlExpCheckCard(exp, sub) == 0) { if (xmlExpCheckCard(exp, sub) == 0) {
#ifdef DEBUG_DERIV #ifdef DEBUG_DERIV
printf("sub generate longuer sequances than exp : can't subsume\n"); printf("sub generate longer sequences than exp : can't subsume\n");
#endif #endif
return(0); return(0);
} }

View file

@ -1,5 +1,5 @@
/* /*
* xmlsave.c: Implemetation of the document serializer * xmlsave.c: Implementation of the document serializer
* *
* See Copyright for the status of this software. * See Copyright for the status of this software.
* *
@ -83,7 +83,6 @@ struct _xmlSaveCtxt {
const xmlChar *encoding; const xmlChar *encoding;
xmlCharEncodingHandlerPtr handler; xmlCharEncodingHandlerPtr handler;
xmlOutputBufferPtr buf; xmlOutputBufferPtr buf;
xmlDocPtr doc;
int options; int options;
int level; int level;
int format; int format;
@ -356,7 +355,7 @@ xmlSaveCtxtInit(xmlSaveCtxtPtr ctxt)
/** /**
* xmlFreeSaveCtxt: * xmlFreeSaveCtxt:
* *
* Free a saving context, destroying the ouptut in any remaining buffer * Free a saving context, destroying the output in any remaining buffer
*/ */
static void static void
xmlFreeSaveCtxt(xmlSaveCtxtPtr ctxt) xmlFreeSaveCtxt(xmlSaveCtxtPtr ctxt)
@ -707,7 +706,6 @@ static void
xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt, xmlDtdPtr dtd) { xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt, xmlDtdPtr dtd) {
xmlOutputBufferPtr buf; xmlOutputBufferPtr buf;
int format, level; int format, level;
xmlDocPtr doc;
if (dtd == NULL) return; if (dtd == NULL) return;
if ((ctxt == NULL) || (ctxt->buf == NULL)) if ((ctxt == NULL) || (ctxt->buf == NULL))
@ -742,14 +740,11 @@ xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt, xmlDtdPtr dtd) {
} }
format = ctxt->format; format = ctxt->format;
level = ctxt->level; level = ctxt->level;
doc = ctxt->doc;
ctxt->format = 0; ctxt->format = 0;
ctxt->level = -1; ctxt->level = -1;
ctxt->doc = dtd->doc;
xmlNodeListDumpOutput(ctxt, dtd->children); xmlNodeListDumpOutput(ctxt, dtd->children);
ctxt->format = format; ctxt->format = format;
ctxt->level = level; ctxt->level = level;
ctxt->doc = doc;
xmlOutputBufferWrite(buf, 2, "]>"); xmlOutputBufferWrite(buf, 2, "]>");
} }
@ -2191,9 +2186,9 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc,
* *
* Dump an XML node, recursive behaviour,children are printed too. * Dump an XML node, recursive behaviour,children are printed too.
* Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 * Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1
* or xmlKeepBlanksDefault(0) was called * or xmlKeepBlanksDefault(0) was called.
* Since this is using xmlBuffer structures it is limited to 2GB and somehow * Since this is using xmlBuffer structures it is limited to 2GB and somehow
* deprecated, use xmlBufNodeDump() instead. * deprecated, use xmlNodeDumpOutput() instead.
* *
* Returns the number of bytes written to the buffer or -1 in case of error * Returns the number of bytes written to the buffer or -1 in case of error
*/ */
@ -2360,7 +2355,6 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
encoding = "UTF-8"; encoding = "UTF-8";
memset(&ctxt, 0, sizeof(ctxt)); memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = doc;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = level; ctxt.level = level;
ctxt.format = format ? 1 : 0; ctxt.format = format ? 1 : 0;
@ -2446,7 +2440,6 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
} }
memset(&ctxt, 0, sizeof(ctxt)); memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = out_doc;
ctxt.buf = out_buff; ctxt.buf = out_buff;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format ? 1 : 0; ctxt.format = format ? 1 : 0;
@ -2565,7 +2558,6 @@ xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) {
buf = xmlOutputBufferCreateFile(f, handler); buf = xmlOutputBufferCreateFile(f, handler);
if (buf == NULL) return(-1); if (buf == NULL) return(-1);
memset(&ctxt, 0, sizeof(ctxt)); memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format ? 1 : 0; ctxt.format = format ? 1 : 0;
@ -2596,7 +2588,7 @@ xmlDocDump(FILE *f, xmlDocPtr cur) {
* xmlSaveFileTo: * xmlSaveFileTo:
* @buf: an output I/O buffer * @buf: an output I/O buffer
* @cur: the document * @cur: the document
* @encoding: the encoding if any assuming the I/O layer handles the trancoding * @encoding: the encoding if any assuming the I/O layer handles the transcoding
* *
* Dump an XML document to an I/O buffer. * Dump an XML document to an I/O buffer.
* Warning ! This call xmlOutputBufferClose() on buf which is not available * Warning ! This call xmlOutputBufferClose() on buf which is not available
@ -2615,7 +2607,6 @@ xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) {
return(-1); return(-1);
} }
memset(&ctxt, 0, sizeof(ctxt)); memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = 0; ctxt.format = 0;
@ -2631,7 +2622,7 @@ xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) {
* xmlSaveFormatFileTo: * xmlSaveFormatFileTo:
* @buf: an output I/O buffer * @buf: an output I/O buffer
* @cur: the document * @cur: the document
* @encoding: the encoding if any assuming the I/O layer handles the trancoding * @encoding: the encoding if any assuming the I/O layer handles the transcoding
* @format: should formatting spaces been added * @format: should formatting spaces been added
* *
* Dump an XML document to an I/O buffer. * Dump an XML document to an I/O buffer.
@ -2655,7 +2646,6 @@ xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur,
return(-1); return(-1);
} }
memset(&ctxt, 0, sizeof(ctxt)); memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format ? 1 : 0; ctxt.format = format ? 1 : 0;
@ -2710,7 +2700,6 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur,
buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression); buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);
if (buf == NULL) return(-1); if (buf == NULL) return(-1);
memset(&ctxt, 0, sizeof(ctxt)); memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format ? 1 : 0; ctxt.format = format ? 1 : 0;

View file

@ -22,7 +22,7 @@
* acquisition episode (xmlSchemaAugmentIDC). * acquisition episode (xmlSchemaAugmentIDC).
* *
* NOTES: * NOTES:
* - Elimated item creation for: <restriction>, <extension>, * - Eliminated item creation for: <restriction>, <extension>,
* <simpleContent>, <complexContent>, <list>, <union> * <simpleContent>, <complexContent>, <list>, <union>
* *
* PROBLEMS: * PROBLEMS:
@ -2780,8 +2780,6 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt,
/** /**
* xmlSchemaPMissingAttrErr: * xmlSchemaPMissingAttrErr:
* @ctxt: the schema validation context * @ctxt: the schema validation context
* @ownerDes: the designation of the owner
* @ownerName: the name of the owner
* @ownerItem: the owner as a schema object * @ownerItem: the owner as a schema object
* @ownerElem: the owner as an element node * @ownerElem: the owner as an element node
* @node: the parent element node of the missing attribute node * @node: the parent element node of the missing attribute node
@ -2815,7 +2813,6 @@ xmlSchemaPMissingAttrErr(xmlSchemaParserCtxtPtr ctxt,
* xmlSchemaPResCompAttrErr: * xmlSchemaPResCompAttrErr:
* @ctxt: the schema validation context * @ctxt: the schema validation context
* @error: the error code * @error: the error code
* @ownerDes: the designation of the owner
* @ownerItem: the owner as a schema object * @ownerItem: the owner as a schema object
* @ownerElem: the owner as an element node * @ownerElem: the owner as an element node
* @name: the name of the attribute holding the QName * @name: the name of the attribute holding the QName
@ -2897,7 +2894,6 @@ xmlSchemaPCustomAttrErr(xmlSchemaParserCtxtPtr ctxt,
* xmlSchemaPIllegalAttrErr: * xmlSchemaPIllegalAttrErr:
* @ctxt: the schema parser context * @ctxt: the schema parser context
* @error: the error code * @error: the error code
* @ownerDes: the designation of the attribute's owner
* @ownerItem: the attribute's owner item * @ownerItem: the attribute's owner item
* @attr: the illegal attribute node * @attr: the illegal attribute node
* *
@ -3109,7 +3105,6 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt,
* @ctxt: the schema validation context * @ctxt: the schema validation context
* @error: the error code * @error: the error code
* @type: the type specifier * @type: the type specifier
* @ownerDes: the designation of the owner
* @ownerItem: the schema object if existent * @ownerItem: the schema object if existent
* @node: the validated node * @node: the validated node
* @value: the validated value * @value: the validated value
@ -3202,7 +3197,6 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt,
* xmlSchemaPContentErr: * xmlSchemaPContentErr:
* @ctxt: the schema parser context * @ctxt: the schema parser context
* @error: the error code * @error: the error code
* @onwerDes: the designation of the holder of the content
* @ownerItem: the owner item of the holder of the content * @ownerItem: the owner item of the holder of the content
* @ownerElem: the node of the holder of the content * @ownerElem: the node of the holder of the content
* @child: the invalid child node * @child: the invalid child node
@ -4307,7 +4301,7 @@ xmlSchemaAnnotDump(FILE * output, xmlSchemaAnnotPtr annot)
* xmlSchemaContentModelDump: * xmlSchemaContentModelDump:
* @particle: the schema particle * @particle: the schema particle
* @output: the file output * @output: the file output
* @depth: the depth used for intentation * @depth: the depth used for indentation
* *
* Dump a SchemaType structure * Dump a SchemaType structure
*/ */
@ -5155,7 +5149,7 @@ subschemas:
* Add an XML schema annotation declaration * Add an XML schema annotation declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaNotationPtr static xmlSchemaNotationPtr
xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
@ -5189,10 +5183,10 @@ xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
* @name: the item name * @name: the item name
* @namespace: the namespace * @namespace: the namespace
* *
* Add an XML schema Attrribute declaration * Add an XML schema Attribute declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaAttributePtr static xmlSchemaAttributePtr
xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
@ -5230,10 +5224,10 @@ xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
* @name: the item name * @name: the item name
* @namespace: the namespace * @namespace: the namespace
* *
* Add an XML schema Attrribute declaration * Add an XML schema Attribute declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaAttributeUsePtr static xmlSchemaAttributeUsePtr
xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt,
@ -5301,9 +5295,9 @@ xmlSchemaAddRedef(xmlSchemaParserCtxtPtr pctxt,
* @nsName: the target namespace * @nsName: the target namespace
* @node: the corresponding node * @node: the corresponding node
* *
* Add an XML schema Attrribute Group definition. * Add an XML schema Attribute Group definition.
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaAttributeGroupPtr static xmlSchemaAttributeGroupPtr
xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt,
@ -5355,7 +5349,7 @@ xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt,
* Add an XML schema Element declaration * Add an XML schema Element declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaElementPtr static xmlSchemaElementPtr
xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt,
@ -5396,7 +5390,7 @@ xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt,
* Add an XML schema item * Add an XML schema item
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaTypePtr static xmlSchemaTypePtr
xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
@ -5493,7 +5487,7 @@ xmlSchemaAddAttributeUseProhib(xmlSchemaParserCtxtPtr pctxt)
* Adds a schema model group * Adds a schema model group
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaModelGroupPtr static xmlSchemaModelGroupPtr
xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt,
@ -5535,7 +5529,7 @@ xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt,
* Adds an XML schema particle component. * Adds an XML schema particle component.
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaParticlePtr static xmlSchemaParticlePtr
xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt, xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt,
@ -5581,7 +5575,7 @@ xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt,
* *
* Add an XML schema Group definition * Add an XML schema Group definition
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaModelGroupDefPtr static xmlSchemaModelGroupDefPtr
xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt,
@ -5627,7 +5621,7 @@ xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt,
* *
* Creates a new wildcard namespace constraint. * Creates a new wildcard namespace constraint.
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaWildcardNsPtr static xmlSchemaWildcardNsPtr
xmlSchemaNewWildcardNsConstraint(xmlSchemaParserCtxtPtr ctxt) xmlSchemaNewWildcardNsConstraint(xmlSchemaParserCtxtPtr ctxt)
@ -5685,7 +5679,7 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
* Adds a wildcard. * Adds a wildcard.
* It corresponds to a xsd:anyAttribute and xsd:any. * It corresponds to a xsd:anyAttribute and xsd:any.
* *
* Returns the new struture or NULL in case of error * Returns the new structure or NULL in case of error
*/ */
static xmlSchemaWildcardPtr static xmlSchemaWildcardPtr
xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
@ -5813,11 +5807,10 @@ xmlSchemaAddElementSubstitutionMember(xmlSchemaParserCtxtPtr pctxt,
* xmlSchemaPValAttrNodeQNameValue: * xmlSchemaPValAttrNodeQNameValue:
* @ctxt: a schema parser context * @ctxt: a schema parser context
* @schema: the schema context * @schema: the schema context
* @ownerDes: the designation of the parent element
* @ownerItem: the parent as a schema object * @ownerItem: the parent as a schema object
* @value: the QName value * @value: the QName value
* @local: the resulting local part if found, the attribute value otherwise
* @uri: the resulting namespace URI if found * @uri: the resulting namespace URI if found
* @local: the resulting local part if found, the attribute value otherwise
* *
* Extracts the local name and the URI of a QName value and validates it. * Extracts the local name and the URI of a QName value and validates it.
* This one is intended to be used on attribute values that * This one is intended to be used on attribute values that
@ -5894,11 +5887,10 @@ xmlSchemaPValAttrNodeQNameValue(xmlSchemaParserCtxtPtr ctxt,
* xmlSchemaPValAttrNodeQName: * xmlSchemaPValAttrNodeQName:
* @ctxt: a schema parser context * @ctxt: a schema parser context
* @schema: the schema context * @schema: the schema context
* @ownerDes: the designation of the owner element
* @ownerItem: the owner as a schema object * @ownerItem: the owner as a schema object
* @attr: the attribute node * @attr: the attribute node
* @local: the resulting local part if found, the attribute value otherwise
* @uri: the resulting namespace URI if found * @uri: the resulting namespace URI if found
* @local: the resulting local part if found, the attribute value otherwise
* *
* Extracts and validates the QName of an attribute value. * Extracts and validates the QName of an attribute value.
* This one is intended to be used on attribute values that * This one is intended to be used on attribute values that
@ -5926,12 +5918,11 @@ xmlSchemaPValAttrNodeQName(xmlSchemaParserCtxtPtr ctxt,
* xmlSchemaPValAttrQName: * xmlSchemaPValAttrQName:
* @ctxt: a schema parser context * @ctxt: a schema parser context
* @schema: the schema context * @schema: the schema context
* @ownerDes: the designation of the parent element
* @ownerItem: the owner as a schema object * @ownerItem: the owner as a schema object
* @ownerElem: the parent node of the attribute * @ownerElem: the parent node of the attribute
* @name: the name of the attribute * @name: the name of the attribute
* @local: the resulting local part if found, the attribute value otherwise
* @uri: the resulting namespace URI if found * @uri: the resulting namespace URI if found
* @local: the resulting local part if found, the attribute value otherwise
* *
* Extracts and validates the QName of an attribute value. * Extracts and validates the QName of an attribute value.
* *
@ -5962,11 +5953,6 @@ xmlSchemaPValAttrQName(xmlSchemaParserCtxtPtr ctxt,
/** /**
* xmlSchemaPValAttrID: * xmlSchemaPValAttrID:
* @ctxt: a schema parser context * @ctxt: a schema parser context
* @schema: the schema context
* @ownerDes: the designation of the parent element
* @ownerItem: the owner as a schema object
* @ownerElem: the parent node of the attribute
* @name: the name of the attribute
* *
* Extracts and validates the ID of an attribute value. * Extracts and validates the ID of an attribute value.
* *
@ -6162,7 +6148,6 @@ xmlGetMinOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
/** /**
* xmlSchemaPGetBoolNodeValue: * xmlSchemaPGetBoolNodeValue:
* @ctxt: a schema validation context * @ctxt: a schema validation context
* @ownerDes: owner designation
* @ownerItem: the owner as a schema item * @ownerItem: the owner as a schema item
* @node: the node holding the value * @node: the node holding the value
* *
@ -6253,7 +6238,7 @@ xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt,
/************************************************************************ /************************************************************************
* * * *
* Shema extraction from an Infoset * * Schema extraction from an Infoset *
* * * *
************************************************************************/ ************************************************************************/
static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr
@ -6286,8 +6271,7 @@ xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt,
/** /**
* xmlSchemaPValAttrNodeValue: * xmlSchemaPValAttrNodeValue:
* *
* @ctxt: a schema parser context * @pctxt: a schema parser context
* @ownerDes: the designation of the parent element
* @ownerItem: the schema object owner if existent * @ownerItem: the schema object owner if existent
* @attr: the schema attribute node being validated * @attr: the schema attribute node being validated
* @value: the value * @value: the value
@ -6360,7 +6344,6 @@ xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt,
* xmlSchemaPValAttrNode: * xmlSchemaPValAttrNode:
* *
* @ctxt: a schema parser context * @ctxt: a schema parser context
* @ownerDes: the designation of the parent element
* @ownerItem: the schema object owner if existent * @ownerItem: the schema object owner if existent
* @attr: the schema attribute node being validated * @attr: the schema attribute node being validated
* @type: the built-in type to be validated against * @type: the built-in type to be validated against
@ -6398,7 +6381,6 @@ xmlSchemaPValAttrNode(xmlSchemaParserCtxtPtr ctxt,
* *
* @ctxt: a schema parser context * @ctxt: a schema parser context
* @node: the element node of the attribute * @node: the element node of the attribute
* @ownerDes: the designation of the parent element
* @ownerItem: the schema object owner if existent * @ownerItem: the schema object owner if existent
* @ownerElem: the owner element node * @ownerElem: the owner element node
* @name: the name of the schema attribute node * @name: the name of the schema attribute node
@ -6543,7 +6525,7 @@ xmlSchemaParseLocalAttributes(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
* @schema: the schema being built * @schema: the schema being built
* @node: a subtree containing XML Schema informations * @node: a subtree containing XML Schema informations
* *
* parse a XML schema Attrribute declaration * parse a XML schema Attribute declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns -1 in case of error, 0 if the declaration is improper and * Returns -1 in case of error, 0 if the declaration is improper and
@ -6840,7 +6822,7 @@ xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt,
dictnsItem = xmlDictLookup(ctxt->dict, nsItem, -1); dictnsItem = xmlDictLookup(ctxt->dict, nsItem, -1);
} }
/* /*
* Avoid dublicate namespaces. * Avoid duplicate namespaces.
*/ */
tmp = wildc->nsSet; tmp = wildc->nsSet;
while (tmp != NULL) { while (tmp != NULL) {
@ -7063,7 +7045,7 @@ xmlSchemaParseNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
* @schema: the schema being built * @schema: the schema being built
* @node: a subtree containing XML Schema informations * @node: a subtree containing XML Schema informations
* *
* parse a XML schema AnyAttrribute declaration * parse a XML schema AnyAttribute declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns a wildcard or NULL. * Returns a wildcard or NULL.
@ -7133,7 +7115,7 @@ xmlSchemaParseAnyAttribute(xmlSchemaParserCtxtPtr ctxt,
* @schema: the schema being built * @schema: the schema being built
* @node: a subtree containing XML Schema informations * @node: a subtree containing XML Schema informations
* *
* parse a XML schema Attrribute declaration * parse a XML schema Attribute declaration
* *WARNING* this interface is highly subject to change * *WARNING* this interface is highly subject to change
* *
* Returns the attribute declaration. * Returns the attribute declaration.
@ -7953,7 +7935,7 @@ xmlSchemaPValAttrBlockFinal(const xmlChar *value,
int ret = 0; int ret = 0;
/* /*
* TODO: This does not check for dublicate entries. * TODO: This does not check for duplicate entries.
*/ */
if ((flags == NULL) || (value == NULL)) if ((flags == NULL) || (value == NULL))
return (-1); return (-1);
@ -8145,7 +8127,7 @@ xmlSchemaCheckCSelectorXPath(xmlSchemaParserCtxtPtr ctxt,
* *
* Adds the annotation to the given schema component. * Adds the annotation to the given schema component.
* *
* Returns the given annotaion. * Returns the given annotation.
*/ */
static xmlSchemaAnnotPtr static xmlSchemaAnnotPtr
xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem, xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem,
@ -8240,7 +8222,7 @@ xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem,
* @schema: the schema being built * @schema: the schema being built
* @node: a subtree containing XML Schema informations * @node: a subtree containing XML Schema informations
* *
* Parses a XML Schema identity-contraint definition's * Parses a XML Schema identity-constraint definition's
* <selector> and <field> elements. * <selector> and <field> elements.
* *
* Returns the parsed identity-constraint definition. * Returns the parsed identity-constraint definition.
@ -8338,7 +8320,7 @@ xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt,
* @schema: the schema being built * @schema: the schema being built
* @node: a subtree containing XML Schema informations * @node: a subtree containing XML Schema informations
* *
* Parses a XML Schema identity-contraint definition. * Parses a XML Schema identity-constraint definition.
* *
* Returns the parsed identity-constraint definition. * Returns the parsed identity-constraint definition.
*/ */
@ -9477,7 +9459,7 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt,
* *
* Parses a XML schema model group definition. * Parses a XML schema model group definition.
* *
* Note that the contraint src-redefine (6.2) can't be applied until * Note that the constraint src-redefine (6.2) can't be applied until
* references have been resolved. So we will do this at the * references have been resolved. So we will do this at the
* component fixup level. * component fixup level.
* *
@ -10185,7 +10167,7 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt,
goto exit; goto exit;
/* /*
* TODO: Not nice, but I'm not 100% sure we will get always an error * TODO: Not nice, but I'm not 100% sure we will get always an error
* as a result of the obove functions; so better rely on pctxt->err * as a result of the above functions; so better rely on pctxt->err
* as well. * as well.
*/ */
if ((ret == 0) && (oldErrs != pctxt->nberrors)) { if ((ret == 0) && (oldErrs != pctxt->nberrors)) {
@ -10279,7 +10261,7 @@ xmlSchemaBuildAbsoluteURI(xmlDictPtr dict, const xmlChar* location,
xmlNodePtr ctxtNode) xmlNodePtr ctxtNode)
{ {
/* /*
* Build an absolue location URI. * Build an absolute location URI.
*/ */
if (location != NULL) { if (location != NULL) {
if (ctxtNode == NULL) if (ctxtNode == NULL)
@ -10361,7 +10343,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt,
if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt))) if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt)))
goto doc_load; goto doc_load;
/* Note that we expect the location to be an absulute URI. */ /* Note that we expect the location to be an absolute URI. */
if (schemaLocation != NULL) { if (schemaLocation != NULL) {
bkt = xmlSchemaGetSchemaBucket(pctxt, schemaLocation); bkt = xmlSchemaGetSchemaBucket(pctxt, schemaLocation);
if ((bkt != NULL) && if ((bkt != NULL) &&
@ -10508,7 +10490,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt,
/* /*
* Chameleon include/redefine: skip loading only if it was * Chameleon include/redefine: skip loading only if it was
* aleady build for the targetNamespace of the including * already build for the targetNamespace of the including
* schema. * schema.
*/ */
/* /*
@ -10516,7 +10498,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt,
* the components into the including schema and modify the * the components into the including schema and modify the
* targetNamespace of those components, do nothing otherwise. * targetNamespace of those components, do nothing otherwise.
* NOTE: This is currently worked-around by compiling the * NOTE: This is currently worked-around by compiling the
* chameleon for every destinct including targetNamespace; thus * chameleon for every distinct including targetNamespace; thus
* not performant at the moment. * not performant at the moment.
* TODO: Check when the namespace in wildcards for chameleons * TODO: Check when the namespace in wildcards for chameleons
* needs to be converted: before we built wildcard intersections * needs to be converted: before we built wildcard intersections
@ -10707,7 +10689,7 @@ doc_load:
exit: exit:
/* /*
* Return the bucket explicitely; this is needed for the * Return the bucket explicitly; this is needed for the
* main schema. * main schema.
*/ */
if (bucket != NULL) if (bucket != NULL)
@ -12888,7 +12870,7 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
ret = 1; ret = 1;
/* /*
* If max and min occurances are default (1) then * If max and min occurrences are default (1) then
* simply iterate over the particles of the <sequence>. * simply iterate over the particles of the <sequence>.
*/ */
if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) { if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) {
@ -13047,7 +13029,7 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; particle->minOccurs < 1 ? 0 : particle->minOccurs - 1;
/* /*
* use a counter to keep track of the number of transtions * use a counter to keep track of the number of transitions
* which went through the choice. * which went through the choice.
*/ */
counter = counter =
@ -13512,7 +13494,7 @@ xmlSchemaGetBuiltInTypeAncestor(xmlSchemaTypePtr type)
* @source: the source wildcard * @source: the source wildcard
* *
* Clones the namespace constraints of source * Clones the namespace constraints of source
* and assignes them to dest. * and assigns them to dest.
* Returns -1 on internal error, 0 otherwise. * Returns -1 on internal error, 0 otherwise.
*/ */
static int static int
@ -13735,7 +13717,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt,
*/ */
xmlSchemaPErr(ctxt, completeWild->node, xmlSchemaPErr(ctxt, completeWild->node,
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, XML_SCHEMAP_UNION_NOT_EXPRESSIBLE,
"The union of the wilcard is not expressible.\n", "The union of the wildcard is not expressible.\n",
NULL, NULL); NULL, NULL);
return(XML_SCHEMAP_UNION_NOT_EXPRESSIBLE); return(XML_SCHEMAP_UNION_NOT_EXPRESSIBLE);
} else if ((!nsFound) && (!absentFound)) { } else if ((!nsFound) && (!absentFound)) {
@ -13972,7 +13954,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt,
(curWild->negNsSet->value != NULL)) { (curWild->negNsSet->value != NULL)) {
xmlSchemaPErr(ctxt, completeWild->node, XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, xmlSchemaPErr(ctxt, completeWild->node, XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE,
"The intersection of the wilcard is not expressible.\n", "The intersection of the wildcard is not expressible.\n",
NULL, NULL); NULL, NULL);
return(XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE); return(XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE);
} }
@ -14443,7 +14425,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt,
* Builds the wildcard and the attribute uses on the given complex type. * Builds the wildcard and the attribute uses on the given complex type.
* Returns -1 if an internal error occurs, 0 otherwise. * Returns -1 if an internal error occurs, 0 otherwise.
* *
* ATTENTION TODO: Experimantally this uses pointer comparisons for * ATTENTION TODO: Experimentally this uses pointer comparisons for
* strings, so recheck this if we start to hardcode some schemata, since * strings, so recheck this if we start to hardcode some schemata, since
* they might not be in the same dict. * they might not be in the same dict.
* NOTE: It is allowed to "extend" the xs:anyType type. * NOTE: It is allowed to "extend" the xs:anyType type.
@ -14643,7 +14625,7 @@ exit_failure:
* Evaluates if a type definition contains the given "final". * Evaluates if a type definition contains the given "final".
* This does take "finalDefault" into account as well. * This does take "finalDefault" into account as well.
* *
* Returns 1 if the type does containt the given "final", * Returns 1 if the type does contain the given "final",
* 0 otherwise. * 0 otherwise.
*/ */
static int static int
@ -14683,7 +14665,7 @@ xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type)
* Schema Component Constraint: Effective Total Range * Schema Component Constraint: Effective Total Range
* (all and sequence) + (choice) * (all and sequence) + (choice)
* *
* Returns the minimun Effective Total Range. * Returns the minimum Effective Total Range.
*/ */
static int static int
xmlSchemaGetParticleTotalRangeMin(xmlSchemaParticlePtr particle) xmlSchemaGetParticleTotalRangeMin(xmlSchemaParticlePtr particle)
@ -14827,12 +14809,12 @@ xmlSchemaIsParticleEmptiable(xmlSchemaParticlePtr particle)
* @actxt: a context * @actxt: a context
* @type: the derived simple type definition * @type: the derived simple type definition
* @baseType: the base type definition * @baseType: the base type definition
* @subset: the subset of ('restriction', ect.) * @subset: the subset of ('restriction', etc.)
* *
* Schema Component Constraint: * Schema Component Constraint:
* Type Derivation OK (Simple) (cos-st-derived-OK) * Type Derivation OK (Simple) (cos-st-derived-OK)
* *
* Checks wheter @type can be validly * Checks whether @type can be validly
* derived from @baseType. * derived from @baseType.
* *
* Returns 0 on success, an positive error code otherwise. * Returns 0 on success, an positive error code otherwise.
@ -14845,7 +14827,7 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr actxt,
{ {
/* /*
* 1 They are the same type definition. * 1 They are the same type definition.
* TODO: The identy check might have to be more complex than this. * TODO: The identity check might have to be more complex than this.
*/ */
if (type == baseType) if (type == baseType)
return (0); return (0);
@ -15055,7 +15037,7 @@ xmlSchemaCheckUnionTypeDefCircular(xmlSchemaParserCtxtPtr pctxt,
* @ctxt: the parser context * @ctxt: the parser context
* @name: the name * @name: the name
* *
* Resolvese type definition references * Resolves type definition references
*/ */
static void static void
xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef,
@ -16132,7 +16114,7 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaAbstractCtxtPtr actxt,
* Calls: * Calls:
* Type Derivation OK (Simple) AND Type Derivation OK (Complex) * Type Derivation OK (Simple) AND Type Derivation OK (Complex)
* *
* Checks wheter @type can be validly derived from @baseType. * Checks whether @type can be validly derived from @baseType.
* *
* Returns 0 on success, an positive error code otherwise. * Returns 0 on success, an positive error code otherwise.
*/ */
@ -16265,7 +16247,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt,
* if created the type via a schema construction API. * if created the type via a schema construction API.
*/ */
if (base->attributeWildcard != NULL) { if (base->attributeWildcard != NULL) {
if (type->attributeWilcard == NULL) { if (type->attributeWildcard == NULL) {
xmlChar *str = NULL; xmlChar *str = NULL;
xmlSchemaCustomErr(ACTXT_CAST pctxt, xmlSchemaCustomErr(ACTXT_CAST pctxt,
@ -16494,7 +16476,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt,
* the {content type} is validly derived given the empty * the {content type} is validly derived given the empty
* set as defined in Type Derivation OK (Simple) ($3.14.6)." * set as defined in Type Derivation OK (Simple) ($3.14.6)."
* *
* ATTENTION TODO: This seems not needed if the type implicitely * ATTENTION TODO: This seems not needed if the type implicitly
* derived from the base type. * derived from the base type.
* *
*/ */
@ -17719,7 +17701,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt,
* *
* *Patterns*: won't be add here, since they are ORed at * *Patterns*: won't be add here, since they are ORed at
* type level and ANDed at ancestor level. This will * type level and ANDed at ancestor level. This will
* happed during validation by walking the base axis * happen during validation by walking the base axis
* of the type. * of the type.
*/ */
for (cur = base->facetSet; cur != NULL; cur = cur->next) { for (cur = base->facetSet; cur != NULL; cur = cur->next) {
@ -18319,7 +18301,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
WXS_BASIC_CAST type, NULL, WXS_BASIC_CAST type, NULL,
"Internal error: xmlSchemaTypeFixup, " "Internal error: xmlSchemaTypeFixup, "
"complex type '%s': the <simpleContent><restriction> " "complex type '%s': the <simpleContent><restriction> "
"is missing a <simpleType> child, but was not catched " "is missing a <simpleType> child, but was not caught "
"by xmlSchemaCheckSRCCT()", type->name); "by xmlSchemaCheckSRCCT()", type->name);
goto exit_failure; goto exit_failure;
} }
@ -18332,7 +18314,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
if (baseType->contentTypeDef == NULL) { if (baseType->contentTypeDef == NULL) {
/* /*
* TODO: Check if this ever happens. xmlSchemaCheckSRCCT * TODO: Check if this ever happens. xmlSchemaCheckSRCCT
* should have catched this already. * should have caught this already.
*/ */
xmlSchemaPCustomErr(pctxt, xmlSchemaPCustomErr(pctxt,
XML_SCHEMAP_INTERNAL, XML_SCHEMAP_INTERNAL,
@ -18575,7 +18557,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
* NOTE that, although we miss to add an intermediate * NOTE that, although we miss to add an intermediate
* <sequence>, this should produce no difference to * <sequence>, this should produce no difference to
* neither the regex compilation of the content model, * neither the regex compilation of the content model,
* nor to the complex type contraints. * nor to the complex type constraints.
*/ */
particle->children->children = particle->children->children =
(xmlSchemaTreeItemPtr) baseType->subtypes; (xmlSchemaTreeItemPtr) baseType->subtypes;
@ -19000,7 +18982,7 @@ xmlSchemaCheckGroupDefCircular(xmlSchemaModelGroupDefPtr item,
* is defined for model groups but not definitions, but since * is defined for model groups but not definitions, but since
* there cannot be any circular model groups without a model group * there cannot be any circular model groups without a model group
* definition (if not using a construction API), we check those * definition (if not using a construction API), we check those
* defintions only. * definitions only.
*/ */
xmlSchemaPCustomErr(ctxt, xmlSchemaPCustomErr(ctxt,
XML_SCHEMAP_MG_PROPS_CORRECT_2, XML_SCHEMAP_MG_PROPS_CORRECT_2,
@ -19073,7 +19055,7 @@ xmlSchemaModelGroupToModelGroupDefFixup(
* This one is intended to be used by * This one is intended to be used by
* xmlSchemaCheckAttrGroupCircular only. * xmlSchemaCheckAttrGroupCircular only.
* *
* Returns the circular attribute grou reference, otherwise NULL. * Returns the circular attribute group reference, otherwise NULL.
*/ */
static xmlSchemaQNameRefPtr static xmlSchemaQNameRefPtr
xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr,
@ -19187,7 +19169,7 @@ xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt,
* @list: the attribute uses * @list: the attribute uses
* *
* Substitutes contained attribute group references * Substitutes contained attribute group references
* for their attribute uses. Wilcards are intersected. * for their attribute uses. Wildcards are intersected.
* Attribute use prohibitions are removed from the list * Attribute use prohibitions are removed from the list
* and returned via the @prohibs list. * and returned via the @prohibs list.
* Pointlessness of attr. prohibs, if a matching attr. decl * Pointlessness of attr. prohibs, if a matching attr. decl
@ -19361,7 +19343,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt,
* {attribute wildcard} property * {attribute wildcard} property
* *
* Substitutes contained attribute group references * Substitutes contained attribute group references
* for their attribute uses. Wilcards are intersected. * for their attribute uses. Wildcards are intersected.
*/ */
static int static int
xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt,
@ -19384,7 +19366,7 @@ xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt,
* @attrGr: the attribute group definition * @attrGr: the attribute group definition
* *
* Substitutes contained attribute group references * Substitutes contained attribute group references
* for their attribute uses. Wilcards are intersected. * for their attribute uses. Wildcards are intersected.
* *
* Schema Component Constraint: * Schema Component Constraint:
* Attribute Group Definition Properties Correct (ag-props-correct) * Attribute Group Definition Properties Correct (ag-props-correct)
@ -19520,8 +19502,8 @@ xmlSchemaResolveAttrGroupReferences(xmlSchemaQNameRefPtr ref,
* Attribute Declaration Properties Correct (a-props-correct) * Attribute Declaration Properties Correct (a-props-correct)
* *
* Validates the value constraints of an attribute declaration/use. * Validates the value constraints of an attribute declaration/use.
* NOTE that this needs the simle type definitions to be already * NOTE that this needs the simple type definitions to be already
* builded and checked. * built and checked.
*/ */
static int static int
xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt,
@ -20508,7 +20490,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt)
* it's not clear if the referenced component needs to originate * it's not clear if the referenced component needs to originate
* from the <redefine>d schema _document_ or the schema; the latter * from the <redefine>d schema _document_ or the schema; the latter
* would include all imported and included sub-schemas of the * would include all imported and included sub-schemas of the
* <redefine>d schema. Currenlty we latter approach is used. * <redefine>d schema. Currently the latter approach is used.
* SUPPLEMENT: It seems that the WG moves towards the latter * SUPPLEMENT: It seems that the WG moves towards the latter
* approach, so we are doing it right. * approach, so we are doing it right.
* *
@ -20623,8 +20605,8 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt)
* This is the complicated case: we need * This is the complicated case: we need
* to apply src-redefine (7.2.2) at a later * to apply src-redefine (7.2.2) at a later
* stage, i.e. when attribute group references * stage, i.e. when attribute group references
* have beed expanded and simple types have * have been expanded and simple types have
* beed fixed. * been fixed.
*/ */
redef->target = prev; redef->target = prev;
} }
@ -20999,7 +20981,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt,
* 1. the base axis of type definitions * 1. the base axis of type definitions
* 2. nested model group definitions * 2. nested model group definitions
* 3. nested attribute group definitions * 3. nested attribute group definitions
* TODO: check for circual substitution groups. * TODO: check for circular substitution groups.
*/ */
for (i = 0; i < nbItems; i++) { for (i = 0; i < nbItems; i++) {
item = items[i]; item = items[i];
@ -21080,7 +21062,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt,
goto exit_error; goto exit_error;
/* /*
* First compute the variety of simple types. This is needed as * First compute the variety of simple types. This is needed as
* a seperate step, since otherwise we won't be able to detect * a separate step, since otherwise we won't be able to detect
* circular union types in all cases. * circular union types in all cases.
*/ */
for (i = 0; i < nbItems; i++) { for (i = 0; i < nbItems; i++) {
@ -21142,7 +21124,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt,
* At this point we need build and check all simple types. * At this point we need build and check all simple types.
*/ */
/* /*
* Apply contraints for attribute declarations. * Apply constraints for attribute declarations.
*/ */
for (i = 0; i < nbItems; i++) { for (i = 0; i < nbItems; i++) {
item = items[i]; item = items[i];
@ -21207,7 +21189,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt,
goto exit_error; goto exit_error;
/* /*
* Complex types are builded and checked. * Complex types are built and checked.
*/ */
for (i = 0; i < nbItems; i++) { for (i = 0; i < nbItems; i++) {
item = con->pending->items[i]; item = con->pending->items[i];
@ -21324,7 +21306,7 @@ exit:
* @ctxt: a schema validation context * @ctxt: a schema validation context
* *
* parse a schema definition resource and build an internal * parse a schema definition resource and build an internal
* XML Shema struture which can be used to validate instances. * XML Schema structure which can be used to validate instances.
* *
* Returns the internal XML Schema structure built from the resource or * Returns the internal XML Schema structure built from the resource or
* NULL in case of error * NULL in case of error
@ -21426,7 +21408,7 @@ exit:
exit_failure: exit_failure:
/* /*
* Quite verbose, but should catch internal errors, which were * Quite verbose, but should catch internal errors, which were
* not communitated. * not communicated.
*/ */
if (mainSchema) { if (mainSchema) {
xmlSchemaFree(mainSchema); xmlSchemaFree(mainSchema);
@ -21893,7 +21875,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
if ((vctxt->inode->node == NULL) || if ((vctxt->inode->node == NULL) ||
(vctxt->inode->node->doc == NULL)) { (vctxt->inode->node->doc == NULL)) {
VERROR_INT("xmlSchemaLookupNamespace", VERROR_INT("xmlSchemaLookupNamespace",
"no node or node's doc avaliable"); "no node or node's doc available");
return (NULL); return (NULL);
} }
ns = xmlSearchNs(vctxt->inode->node->doc, ns = xmlSearchNs(vctxt->inode->node->doc,
@ -22106,7 +22088,7 @@ xmlSchemaIDCStoreNodeTableItem(xmlSchemaValidCtxtPtr vctxt,
xmlSchemaPSVIIDCNodePtr item) xmlSchemaPSVIIDCNodePtr item)
{ {
/* /*
* Add to gobal list. * Add to global list.
*/ */
if (vctxt->idcNodes == NULL) { if (vctxt->idcNodes == NULL) {
vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *) vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *)
@ -22147,7 +22129,7 @@ xmlSchemaIDCStoreKey(xmlSchemaValidCtxtPtr vctxt,
xmlSchemaPSVIIDCKeyPtr key) xmlSchemaPSVIIDCKeyPtr key)
{ {
/* /*
* Add to gobal list. * Add to global list.
*/ */
if (vctxt->idcKeys == NULL) { if (vctxt->idcKeys == NULL) {
vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *) vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *)
@ -22804,7 +22786,7 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
VERROR(XML_SCHEMAV_CVC_IDC, VERROR(XML_SCHEMAV_CVC_IDC,
WXS_BASIC_CAST sto->matcher->aidc->def, WXS_BASIC_CAST sto->matcher->aidc->def,
"Warning: No precomputed value available, the value " "Warning: No precomputed value available, the value "
"was either invalid or something strange happend"); "was either invalid or something strange happened");
sto->nbHistory--; sto->nbHistory--;
goto deregister_check; goto deregister_check;
} else { } else {
@ -22825,7 +22807,7 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
* <bar> * <bar>
* </scope> * </scope>
* *
* The size of the list is only dependant on the depth of * The size of the list is only dependent on the depth of
* the tree. * the tree.
* An entry will be NULLed in selector_leave, i.e. when * An entry will be NULLed in selector_leave, i.e. when
* we hit the target's * we hit the target's
@ -23366,6 +23348,8 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt,
* Get/create the IDC binding on this element for the IDC definition. * Get/create the IDC binding on this element for the IDC definition.
*/ */
bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); bind = xmlSchemaIDCAcquireBinding(vctxt, matcher);
if (bind == NULL)
goto internal_error;
if (! WXS_ILIST_IS_EMPTY(bind->dupls)) { if (! WXS_ILIST_IS_EMPTY(bind->dupls)) {
dupls = (xmlSchemaPSVIIDCNodePtr *) bind->dupls->items; dupls = (xmlSchemaPSVIIDCNodePtr *) bind->dupls->items;
@ -24118,7 +24102,7 @@ xmlSchemaClearElemInfo(xmlSchemaValidCtxtPtr vctxt,
* @vctxt: the schema validation context * @vctxt: the schema validation context
* *
* Creates/reuses and initializes the element info item for * Creates/reuses and initializes the element info item for
* the currect tree depth. * the current tree depth.
* *
* Returns the element info item or NULL on API or internal errors. * Returns the element info item or NULL on API or internal errors.
*/ */
@ -24391,7 +24375,7 @@ pattern_and_enum:
found = 1; found = 1;
/* /*
* NOTE that for patterns, @value needs to be the * NOTE that for patterns, @value needs to be the
* normalized vaule. * normalized value.
*/ */
ret = xmlRegexpExec(facetLink->facet->regexp, value); ret = xmlRegexpExec(facetLink->facet->regexp, value);
if (ret == 1) if (ret == 1)
@ -24665,7 +24649,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt,
ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1;
} }
} }
if (fireErrors && (ret > 0)) else if (fireErrors && (ret > 0))
xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1); xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1);
} else if (WXS_IS_LIST(type)) { } else if (WXS_IS_LIST(type)) {
@ -24928,7 +24912,7 @@ xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt,
else { else {
const xmlChar *nsName = NULL, *local = NULL; const xmlChar *nsName = NULL, *local = NULL;
/* /*
* TODO: We should report a *warning* that the type was overriden * TODO: We should report a *warning* that the type was overridden
* by the instance. * by the instance.
*/ */
ACTIVATE_ATTRIBUTE(iattr); ACTIVATE_ATTRIBUTE(iattr);
@ -26347,7 +26331,7 @@ default_psvi:
XML_SCHEMA_ELEM_INFO_HAS_ELEM_CONTENT) { XML_SCHEMA_ELEM_INFO_HAS_ELEM_CONTENT) {
ret = XML_SCHEMAV_CVC_ELT_5_2_2_1; ret = XML_SCHEMAV_CVC_ELT_5_2_2_1;
VERROR(ret, NULL, VERROR(ret, NULL,
"The content must not containt element nodes since " "The content must not contain element nodes since "
"there is a fixed value constraint"); "there is a fixed value constraint");
goto end_elem; goto end_elem;
} else { } else {
@ -26554,7 +26538,7 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt)
if (ptype->builtInType == XML_SCHEMAS_ANYTYPE) { if (ptype->builtInType == XML_SCHEMAS_ANYTYPE) {
/* /*
* Workaround for "anyType": we have currently no content model * Workaround for "anyType": we have currently no content model
* assigned for "anyType", so handle it explicitely. * assigned for "anyType", so handle it explicitly.
* "anyType" has an unbounded, lax "any" wildcard. * "anyType" has an unbounded, lax "any" wildcard.
*/ */
vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema, vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema,
@ -26629,7 +26613,7 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt)
return (-1); return (-1);
} }
/* /*
* Safety belf for evaluation if the cont. model was already * Safety belt for evaluation if the cont. model was already
* examined to be invalid. * examined to be invalid.
*/ */
if (pielem->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) { if (pielem->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) {
@ -28818,7 +28802,7 @@ xmlSchemaValidateSetLocator(xmlSchemaValidCtxtPtr vctxt,
* *
* Internal locator function for the readers * Internal locator function for the readers
* *
* Returns 0 in case the Schema validation could be (des)activated and * Returns 0 in case the Schema validation could be (de)activated and
* -1 in case of error. * -1 in case of error.
*/ */
static int static int

View file

@ -70,7 +70,7 @@ struct _xmlSchemaValDate {
unsigned int hour :5; /* 0 <= hour <= 24 */ unsigned int hour :5; /* 0 <= hour <= 24 */
unsigned int min :6; /* 0 <= min <= 59 */ unsigned int min :6; /* 0 <= min <= 59 */
double sec; double sec;
unsigned int tz_flag :1; /* is tzo explicitely set? */ unsigned int tz_flag :1; /* is tzo explicitly set? */
signed int tzo :12; /* -1440 <= tzo <= 1440; signed int tzo :12; /* -1440 <= tzo <= 1440;
currently only -840 to +840 are needed */ currently only -840 to +840 are needed */
}; };
@ -1129,7 +1129,7 @@ xmlSchemaGetBuiltInListSimpleTypeItemType(xmlSchemaTypePtr type)
#define VALID_HOUR(hr) ((hr >= 0) && (hr <= 23)) #define VALID_HOUR(hr) ((hr >= 0) && (hr <= 23))
#define VALID_MIN(min) ((min >= 0) && (min <= 59)) #define VALID_MIN(min) ((min >= 0) && (min <= 59))
#define VALID_SEC(sec) ((sec >= 0) && (sec < 60)) #define VALID_SEC(sec) ((sec >= 0) && (sec < 60))
#define VALID_TZO(tzo) ((tzo > -840) && (tzo < 840)) #define VALID_TZO(tzo) ((tzo >= -840) && (tzo <= 840))
#define IS_LEAP(y) \ #define IS_LEAP(y) \
(((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0))
@ -2130,7 +2130,7 @@ xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo,
* @value: the value to check * @value: the value to check
* @val: the return computed value * @val: the return computed value
* @node: the node containing the value * @node: the node containing the value
* flags: flags to control the vlidation * flags: flags to control the validation
* *
* Check that a value conforms to the lexical space of the atomic type. * Check that a value conforms to the lexical space of the atomic type.
* if true a value is computed and returned in @val. * if true a value is computed and returned in @val.
@ -2155,7 +2155,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
return (-1); return (-1);
/* /*
* validating a non existant text node is similar to validating * validating a non existent text node is similar to validating
* an empty one. * an empty one.
*/ */
if (value == NULL) if (value == NULL)
@ -2925,7 +2925,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
if (*value != 0) { if (*value != 0) {
xmlURIPtr uri; xmlURIPtr uri;
xmlChar *tmpval, *cur; xmlChar *tmpval, *cur;
if (normOnTheFly) { if ((norm == NULL) && (normOnTheFly)) {
norm = xmlSchemaCollapseString(value); norm = xmlSchemaCollapseString(value);
if (norm != NULL) if (norm != NULL)
value = norm; value = norm;
@ -3067,7 +3067,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
* following cases can arise: (1) the final quantum of * following cases can arise: (1) the final quantum of
* encoding input is an integral multiple of 24 bits; here, * encoding input is an integral multiple of 24 bits; here,
* the final unit of encoded output will be an integral * the final unit of encoded output will be an integral
* multiple ofindent: Standard input:701: Warning:old style * multiple of indent: Standard input:701: Warning:old style
* assignment ambiguity in "=*". Assuming "= *" 4 characters * assignment ambiguity in "=*". Assuming "= *" 4 characters
* with no "=" padding, (2) the final * with no "=" padding, (2) the final
* quantum of encoding input is exactly 8 bits; here, the * quantum of encoding input is exactly 8 bits; here, the
@ -3628,8 +3628,10 @@ xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
minday = 0; minday = 0;
maxday = 0; maxday = 0;
} else { } else {
maxday = 366 * ((myear + 3) / 4) + /* FIXME: This doesn't take leap year exceptions every 100/400 years
365 * ((myear - 1) % 4); into account. */
maxday = 365 * myear + (myear + 3) / 4;
/* FIXME: Needs to be calculated separately */
minday = maxday - 1; minday = maxday - 1;
} }
@ -3877,7 +3879,7 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
temp = r->mon + carry; temp = r->mon + carry;
r->mon = (unsigned int) MODULO_RANGE(temp, 1, 13); r->mon = (unsigned int) MODULO_RANGE(temp, 1, 13);
r->year = r->year + (unsigned int) FQUOTIENT_RANGE(temp, 1, 13); r->year = r->year + (long) FQUOTIENT_RANGE(temp, 1, 13);
if (r->year == 0) { if (r->year == 0) {
if (temp < 1) if (temp < 1)
r->year--; r->year--;

View file

@ -541,8 +541,8 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version,
if (encoding != NULL) { if (encoding != NULL) {
encoder = xmlFindCharEncodingHandler(encoding); encoder = xmlFindCharEncodingHandler(encoding);
if (encoder == NULL) { if (encoder == NULL) {
xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, xmlWriterErrMsg(writer, XML_ERR_UNSUPPORTED_ENCODING,
"xmlTextWriterStartDocument : out of memory!\n"); "xmlTextWriterStartDocument : unsupported encoding\n");
return -1; return -1;
} }
} }
@ -801,7 +801,7 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer)
* xmlTextWriterEndComment: * xmlTextWriterEndComment:
* @writer: the xmlTextWriterPtr * @writer: the xmlTextWriterPtr
* *
* End the current xml coment. * End the current xml comment.
* *
* Returns the bytes written (may be 0 because of buffering) or -1 in case of error * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
*/ */

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@
* be parsed beforehand instead of a progressive evaluation * be parsed beforehand instead of a progressive evaluation
* TODO: Access into entities references are not supported now ... * TODO: Access into entities references are not supported now ...
* need a start to be able to pop out of entities refs since * need a start to be able to pop out of entities refs since
* parent is the endity declaration, not the ref. * parent is the entity declaration, not the ref.
*/ */
#include <string.h> #include <string.h>
@ -1186,7 +1186,7 @@ xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) {
static void static void
xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) { xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
/* /*
* XPointer don't allow by syntax to address in mutirooted trees * XPointer don't allow by syntax to address in multirooted trees
* this might prove useful in some cases, warn about it. * this might prove useful in some cases, warn about it.
*/ */
if ((name == NULL) && (CUR == '/') && (NXT(1) != '1')) { if ((name == NULL) && (CUR == '/') && (NXT(1) != '1')) {
@ -1202,13 +1202,23 @@ xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
} }
while (CUR == '/') { while (CUR == '/') {
int child = 0; int child = 0, overflow = 0;
NEXT; NEXT;
while ((CUR >= '0') && (CUR <= '9')) { while ((CUR >= '0') && (CUR <= '9')) {
child = child * 10 + (CUR - '0'); int d = CUR - '0';
if (child > INT_MAX / 10)
overflow = 1;
else
child *= 10;
if (child > INT_MAX - d)
overflow = 1;
else
child += d;
NEXT; NEXT;
} }
if (overflow)
child = 0;
xmlXPtrGetChildNo(ctxt, child); xmlXPtrGetChildNo(ctxt, child);
} }
} }

View file

@ -1,5 +1,5 @@
/** /**
* xzlib.c: front end for the transparent suport of lzma compression * xzlib.c: front end for the transparent support of lzma compression
* at the I/O layer, based on an example file from lzma project * at the I/O layer, based on an example file from lzma project
* *
* See Copyright for the status of this software. * See Copyright for the status of this software.
@ -71,7 +71,7 @@ typedef struct {
int err; /* error code */ int err; /* error code */
char *msg; /* error message */ char *msg; /* error message */
/* lzma stream */ /* lzma stream */
int init; /* is the iniflate stream initialized */ int init; /* is the inflate stream initialized */
lzma_stream strm; /* stream structure in-place (not a pointer) */ lzma_stream strm; /* stream structure in-place (not a pointer) */
char padding1[32]; /* padding allowing to cope with possible char padding1[32]; /* padding allowing to cope with possible
extensions of above structure without extensions of above structure without

View file

@ -1,5 +1,5 @@
/** /**
* xzlib.h: header for the front end for the transparent suport of lzma * xzlib.h: header for the front end for the transparent support of lzma
* compression at the I/O layer * compression at the I/O layer
* *
* See Copyright for the status of this software. * See Copyright for the status of this software.