Reactos

[LIBXML2] Update to version 2.9.10. CORE-16952

+2221 -2032
+2 -2
media/doc/3rd Party Files.txt
··· 40 40 Website: http://www.gnu.org/software/adns/ | http://adns.jgaa.com 41 41 42 42 Title: LibXML 43 - Used Version: 2.9.9 43 + Used Version: 2.9.10 44 44 Website: http://xmlsoft.org | ftp://xmlsoft.org/libxml2/ 45 45 46 46 Title: Libxslt ··· 84 84 Website: http://www.simplesystems.org/libtiff/ 85 85 86 86 Title: mbed TLS 87 - Used Version: 2.7.14 87 + Used Version: 2.7.15 88 88 Website: https://tls.mbed.org/ 89 89 90 90 Title: libpng
+6 -6
sdk/include/reactos/libs/libxml/c14n.h
··· 28 28 #include <libxml/xpath.h> 29 29 30 30 /* 31 - * XML Canonicazation 31 + * XML Canonicalization 32 32 * http://www.w3.org/TR/xml-c14n 33 33 * 34 - * Exclusive XML Canonicazation 34 + * Exclusive XML Canonicalization 35 35 * http://www.w3.org/TR/xml-exc-c14n 36 36 * 37 37 * Canonical form of an XML document could be created if and only if 38 38 * a) default attributes (if any) are added to all nodes 39 39 * b) all character and parsed entity references are resolved 40 - * In order to achive this in libxml2 the document MUST be loaded with 41 - * following global setings: 40 + * In order to achieve this in libxml2 the document MUST be loaded with 41 + * following global settings: 42 42 * 43 43 * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 44 44 * xmlSubstituteEntitiesDefault(1); ··· 59 59 * 60 60 */ 61 61 typedef enum { 62 - XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ 62 + XML_C14N_1_0 = 0, /* Original C14N 1.0 spec */ 63 63 XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ 64 64 XML_C14N_1_1 = 2 /* C14N 1.1 spec */ 65 65 } xmlC14NMode; ··· 96 96 /** 97 97 * xmlC14NIsVisibleCallback: 98 98 * @user_data: user data 99 - * @node: the curent node 99 + * @node: the current node 100 100 * @parent: the parent node 101 101 * 102 102 * Signature for a C14N callback on visible nodes
+1 -1
sdk/include/reactos/libs/libxml/catalog.h
··· 39 39 /** 40 40 * XML_CATALOG_PI: 41 41 * 42 - * The specific XML Catalog Processing Instuction name. 42 + * The specific XML Catalog Processing Instruction name. 43 43 */ 44 44 #define XML_CATALOG_PI \ 45 45 (const xmlChar *) "oasis-xml-catalog"
+6 -13
sdk/include/reactos/libs/libxml/dict.h
··· 11 11 #ifndef __XML_DICT_H__ 12 12 #define __XML_DICT_H__ 13 13 14 + #include <stddef.h> 15 + #include <libxml/xmlversion.h> 16 + 14 17 #ifdef __cplusplus 15 - #define __XML_EXTERNC extern "C" 16 - #else 17 - #define __XML_EXTERNC 18 + extern "C" { 18 19 #endif 19 20 20 21 /* 21 22 * The dictionary. 22 23 */ 23 - __XML_EXTERNC typedef struct _xmlDict xmlDict; 24 - __XML_EXTERNC typedef xmlDict *xmlDictPtr; 25 - 26 - #include <limits.h> 27 - #include <libxml/xmlversion.h> 28 - #include <libxml/tree.h> 29 - 30 - #ifdef __cplusplus 31 - extern "C" { 32 - #endif 24 + typedef struct _xmlDict xmlDict; 25 + typedef xmlDict *xmlDictPtr; 33 26 34 27 /* 35 28 * Initializer
+2 -2
sdk/include/reactos/libs/libxml/hash.h
··· 80 80 /** 81 81 * xmlHashScanner: 82 82 * @payload: the data in the hash 83 - * @data: extra scannner data 83 + * @data: extra scanner data 84 84 * @name: the name associated 85 85 * 86 86 * Callback when scanning data in a hash with the simple scanner. ··· 89 89 /** 90 90 * xmlHashScannerFull: 91 91 * @payload: the data in the hash 92 - * @data: extra scannner data 92 + * @data: extra scanner data 93 93 * @name: the name associated 94 94 * @name2: the second name associated 95 95 * @name3: the third name associated
+4 -4
sdk/include/reactos/libs/libxml/parser.h
··· 283 283 void * *pushTab; /* array of data for push */ 284 284 xmlHashTablePtr attsDefault; /* defaulted attributes if any */ 285 285 xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ 286 - int nsWellFormed; /* is the document XML Nanespace okay */ 286 + int nsWellFormed; /* is the document XML Namespace okay */ 287 287 int options; /* Extra options */ 288 288 289 289 /* 290 - * Those fields are needed only for treaming parsing so far 290 + * Those fields are needed only for streaming parsing so far 291 291 */ 292 292 int dictNames; /* Use dictionary names for the tree */ 293 293 int freeElemsNr; /* number of freed element nodes */ ··· 1097 1097 XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ 1098 1098 XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ 1099 1099 XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ 1100 - XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ 1100 + XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitution */ 1101 1101 XML_PARSE_NONET = 1<<11,/* Forbid network access */ 1102 1102 XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */ 1103 1103 XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ ··· 1191 1191 /** 1192 1192 * xmlFeature: 1193 1193 * 1194 - * Used to examine the existance of features that can be enabled 1194 + * Used to examine the existence of features that can be enabled 1195 1195 * or disabled at compile-time. 1196 1196 * They used to be called XML_FEATURE_xxx but this clashed with Expat 1197 1197 */
+1 -1
sdk/include/reactos/libs/libxml/parserInternals.h
··· 43 43 /** 44 44 * XML_MAX_NAME_LENGTH: 45 45 * 46 - * Maximum size allowed for a markup identitier 46 + * Maximum size allowed for a markup identifier. 47 47 * This is not a limitation of the parser but a safety boundary feature, 48 48 * use XML_PARSE_HUGE option to override it. 49 49 * Note that with the use of parsing dictionaries overriding the limit
+6 -6
sdk/include/reactos/libs/libxml/schemasInternals.h
··· 321 321 /** 322 322 * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: 323 323 * 324 - * The attribute wildcard has been already builded. 324 + * The attribute wildcard has been built. 325 325 */ 326 326 #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 327 327 /** 328 328 * XML_SCHEMAS_ATTRGROUP_GLOBAL: 329 329 * 330 - * The attribute wildcard has been already builded. 330 + * The attribute group has been defined. 331 331 */ 332 332 #define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 333 333 /** ··· 725 725 /** 726 726 * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: 727 727 * 728 - * disallowed substitutions: "substituion" 728 + * disallowed substitutions: "substitution" 729 729 */ 730 730 #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 731 731 /** ··· 789 789 xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ 790 790 xmlSchemaContentType contentType; 791 791 const xmlChar *refPrefix; /* Deprecated; not used */ 792 - xmlSchemaValPtr defVal; /* The compiled value contraint. */ 792 + xmlSchemaValPtr defVal; /* The compiled value constraint. */ 793 793 void *idcs; /* The identity-constraint defs */ 794 794 }; 795 795 ··· 881 881 /** 882 882 * XML_SCHEMAS_FINAL_DEFAULT_LIST: 883 883 * 884 - * the cshema has "list" in the set of finalDefault. 884 + * the schema has "list" in the set of finalDefault. 885 885 */ 886 886 #define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 887 887 /** ··· 942 942 xmlDictPtr dict; 943 943 void *includes; /* the includes, this is opaque for now */ 944 944 int preserve; /* whether to free the document */ 945 - int counter; /* used to give ononymous components unique names */ 945 + int counter; /* used to give anonymous components unique names */ 946 946 xmlHashTablePtr idcDef; /* All identity-constraint defs. */ 947 947 void *volatiles; /* Obsolete */ 948 948 };
+1 -1
sdk/include/reactos/libs/libxml/tree.h
··· 527 527 * xmlDocProperty 528 528 * 529 529 * Set of properties of the document as found by the parser 530 - * Some of them are linked to similary named xmlParserOption 530 + * Some of them are linked to similarly named xmlParserOption 531 531 */ 532 532 typedef enum { 533 533 XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */
+1 -1
sdk/include/reactos/libs/libxml/xlink.h
··· 26 26 * of namespaces. If "foo" is the prefix for "http://foo.com/" 27 27 * then the link detection layer will expand role="foo:myrole" 28 28 * to "http://foo.com/:myrole". 29 - * NOTE: the link detection layer will expand URI-Refences found on 29 + * NOTE: the link detection layer will expand URI-References found on 30 30 * href attributes by using the base mechanism if found. 31 31 */ 32 32 typedef xmlChar *xlinkHRef;
+2 -2
sdk/include/reactos/libs/libxml/xmlIO.h
··· 27 27 * @filename: the filename or URI 28 28 * 29 29 * Callback used in the I/O Input API to detect if the current handler 30 - * can provide input fonctionnalities for this resource. 30 + * can provide input functionality for this resource. 31 31 * 32 32 * Returns 1 if yes and 0 if another Input module should be used 33 33 */ ··· 73 73 * @filename: the filename or URI 74 74 * 75 75 * Callback used in the I/O Output API to detect if the current handler 76 - * can provide output fonctionnalities for this resource. 76 + * can provide output functionality for this resource. 77 77 * 78 78 * Returns 1 if yes and 0 if another Output module should be used 79 79 */
+1 -1
sdk/include/reactos/libs/libxml/xmlerror.h
··· 837 837 * xmlGenericErrorFunc: 838 838 * @ctx: a parsing context 839 839 * @msg: the message 840 - * @...: the extra arguments of the varags to format the message 840 + * @...: the extra arguments of the varargs to format the message 841 841 * 842 842 * Signature of the function to use when there is an error and 843 843 * no parsing or validity context available .
-9
sdk/include/reactos/libs/libxml/xmlexports.h
··· 73 73 #define XMLCALL __cdecl 74 74 #endif 75 75 #define XMLCDECL __cdecl 76 - #if !defined _REENTRANT 77 - #define _REENTRANT 78 - #endif 79 76 #endif 80 77 81 78 /* Windows platform with Borland compiler */ ··· 97 94 #endif 98 95 #define XMLCALL __cdecl 99 96 #define XMLCDECL __cdecl 100 - #if !defined _REENTRANT 101 - #define _REENTRANT 102 - #endif 103 97 #endif 104 98 105 99 /* Windows platform with GNU compiler (Mingw) */ ··· 126 120 #endif 127 121 #define XMLCALL __cdecl 128 122 #define XMLCDECL __cdecl 129 - #if !defined _REENTRANT 130 - #define _REENTRANT 131 - #endif 132 123 #endif 133 124 134 125 /* Cygwin platform (does not define _WIN32), GNU compiler */
+9 -10
sdk/include/reactos/libs/libxml/xmlversion.h
··· 29 29 * 30 30 * the version string like "1.2.3" 31 31 */ 32 - #define LIBXML_DOTTED_VERSION "2.9.9" 32 + #define LIBXML_DOTTED_VERSION "2.9.10" 33 33 34 34 /** 35 35 * LIBXML_VERSION: 36 36 * 37 37 * the version number: 1.2.3 value is 10203 38 38 */ 39 - #define LIBXML_VERSION 20909 39 + #define LIBXML_VERSION 20910 40 40 41 41 /** 42 42 * LIBXML_VERSION_STRING: 43 43 * 44 44 * the version number string, 1.2.3 value is "10203" 45 45 */ 46 - #define LIBXML_VERSION_STRING "20909" 46 + #define LIBXML_VERSION_STRING "20910" 47 47 48 48 /** 49 49 * LIBXML_VERSION_EXTRA: 50 50 * 51 51 * extra version information, used to show a CVS compilation 52 52 */ 53 - #define LIBXML_VERSION_EXTRA "-GITv2.9.9-rc2-2-g7c4949afa" 53 + #define LIBXML_VERSION_EXTRA "-GITv2.9.10-rc1-2-ga5bb6aaa2" 54 54 55 55 /** 56 56 * LIBXML_TEST_VERSION: ··· 58 58 * Macro to check that the libxml version in use is compatible with 59 59 * the version the software has been compiled against 60 60 */ 61 - #define LIBXML_TEST_VERSION xmlCheckVersion(20909); 61 + #define LIBXML_TEST_VERSION xmlCheckVersion(20910); 62 62 63 63 #ifndef VMS 64 64 #if 0 ··· 91 91 * Whether the thread support is configured in 92 92 */ 93 93 #if 1 94 - #if defined(_REENTRANT) || defined(__MT__) || \ 95 - (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) 96 94 #define LIBXML_THREAD_ENABLED 97 - #endif 98 95 #endif 99 96 100 97 /** ··· 291 288 * 292 289 * Whether ISO-8859-* support is made available in case iconv is not 293 290 */ 294 - #if 0 291 + #if 1 295 292 #define LIBXML_ISO8859X_ENABLED 296 293 #endif 297 294 ··· 353 350 * LIBXML_EXPR_ENABLED: 354 351 * 355 352 * Whether the formal expressions interfaces are compiled in 353 + * 354 + * This code is unused and disabled unconditionally for now. 356 355 */ 357 - #if 1 356 + #if 0 358 357 #define LIBXML_EXPR_ENABLED 359 358 #endif 360 359
+3 -4
sdk/include/reactos/libs/libxml/xmlversion.h.in
··· 91 91 * Whether the thread support is configured in 92 92 */ 93 93 #if @WITH_THREADS@ 94 - #if defined(_REENTRANT) || defined(__MT__) || \ 95 - (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) 96 94 #define LIBXML_THREAD_ENABLED 97 - #endif 98 95 #endif 99 96 100 97 /** ··· 353 350 * LIBXML_EXPR_ENABLED: 354 351 * 355 352 * Whether the formal expressions interfaces are compiled in 353 + * 354 + * This code is unused and disabled unconditionally for now. 356 355 */ 357 - #if @WITH_SCHEMAS@ 356 + #if 0 358 357 #define LIBXML_EXPR_ENABLED 359 358 #endif 360 359
+11 -2
sdk/include/reactos/libs/libxml/xpath.h
··· 70 70 XPATH_INVALID_CHAR_ERROR, 71 71 XPATH_INVALID_CTXT, 72 72 XPATH_STACK_ERROR, 73 - XPATH_FORBID_VARIABLE_ERROR 73 + XPATH_FORBID_VARIABLE_ERROR, 74 + XPATH_OP_LIMIT_EXCEEDED, 75 + XPATH_RECURSION_LIMIT_EXCEEDED 74 76 } xmlXPathError; 75 77 76 78 /* ··· 82 84 int nodeNr; /* number of nodes in the set */ 83 85 int nodeMax; /* size of the array as allocated */ 84 86 xmlNodePtr *nodeTab; /* array of nodes in no particular order */ 85 - /* @@ with_ns to check wether namespace nodes should be looked at @@ */ 87 + /* @@ with_ns to check whether namespace nodes should be looked at @@ */ 86 88 }; 87 89 88 90 /* ··· 352 354 353 355 /* Cache for reusal of XPath objects */ 354 356 void *cache; 357 + 358 + /* Resource limits */ 359 + unsigned long opLimit; 360 + unsigned long opCount; 361 + int depth; 362 + int maxDepth; 363 + int maxParserDepth; 355 364 }; 356 365 357 366 /*
+56 -56
sdk/lib/3rdparty/libxml2/ChangeLog
··· 463 463 allow to make Name and NmToken validations based on the parser 464 464 flags, more specifically the 5th edition of XML or not 465 465 * HTMLparser.c tree.c: small side effects for the previous changes 466 - * parser.c SAX2.c valid.c: the bulk of teh changes are here, 466 + * parser.c SAX2.c valid.c: the bulk of the changes are here, 467 467 the parser and validation behaviour can be affected, parsing 468 468 flags need to be copied, lot of changes. Also fixing various 469 469 validation problems in the regression tests. ··· 1328 1328 Tue Mar 20 09:58:13 CET 2007 Daniel Veillard <daniel@veillard.com> 1329 1329 1330 1330 * nanoftp.c: applied patch from Björn Wiberg to try to fix again 1331 - the silly __ss_familly problem on various AIXes, should fix #420184 1331 + the silly __ss_family problem on various AIXes, should fix #420184 1332 1332 1333 1333 Wed Mar 14 20:30:38 HKT 2007 William Brack <wbrack@mmm.com.hk> 1334 1334 ··· 1519 1519 1520 1520 Tue Oct 17 22:04:31 CEST 2006 Daniel Veillard <daniel@veillard.com> 1521 1521 1522 - * HTMLparser.c: fixed teh 2 stupid bugs affecting htmlReadDoc() and 1522 + * HTMLparser.c: fixed the 2 stupid bugs affecting htmlReadDoc() and 1523 1523 htmlReadIO() this should fix #340322 1524 1524 1525 1525 Tue Oct 17 21:39:23 CEST 2006 Daniel Veillard <daniel@veillard.com> ··· 1680 1680 Tue Oct 10 10:33:43 CEST 2006 Daniel Veillard <daniel@veillard.com> 1681 1681 1682 1682 * python/libxml.py python/types.c: applied patch from Ross Reedstrom, 1683 - Brian West and Stefan Anca to add XPointer suport to the Python bindings 1683 + Brian West and Stefan Anca to add XPointer support to the Python bindings 1684 1684 1685 1685 Fri Sep 29 11:13:59 CEST 2006 Daniel Veillard <daniel@veillard.com> 1686 1686 ··· 2022 2022 2023 2023 * xpath.c: Enhanced xmlXPathNodeCollectAndTest() to avoid 2024 2024 recreation (if possible) of the node-set which is used to 2025 - collect the nodes in the current axis for the currect context 2025 + collect the nodes in the current axis for the current context 2026 2026 node. Especially for "//foo" this will decrease dramatically 2027 2027 the number of created node-sets, since for each node in the 2028 2028 result node-set of the evaluation of descendant-or-self::node() ··· 2056 2056 xmlXPathNodeSetDupNs(); thus a pure memcpy is not possible. 2057 2057 A flag on the node-set indicating if namespace nodes are in 2058 2058 the set would help here; this is the 3rd flag which would 2059 - be usefull with node-sets. The current flags I have in mind: 2059 + be useful with node-sets. The current flags I have in mind: 2060 2060 1) Is a node-set already sorted? 2061 2061 This would allow for rebust and optimizable sorting 2062 2062 behaviour. ··· 2112 2112 compilation time (unlike normal XPath, where we can bind 2113 2113 namespace names to prefixes at execution time). 2114 2114 * pattern.c: Enhanced to use a string dict for local-names, 2115 - ns-prefixes and and namespace-names. 2115 + ns-prefixes and namespace-names. 2116 2116 Fixed xmlStreamPushInternal() not to use string-pointer 2117 2117 comparison if a dict is available; this won't work, since 2118 2118 one does not know it the given strings originate from the ··· 2269 2269 Fri Mar 10 08:40:55 EST 2006 Daniel Veillard <daniel@veillard.com> 2270 2270 2271 2271 * c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few 2272 - warning raised by gcc-4.1 and latests changes 2272 + warning raised by gcc-4.1 and latest changes 2273 2273 2274 2274 Fri Mar 10 01:34:42 CET 2006 Daniel Veillard <daniel@veillard.com> 2275 2275 ··· 2967 2967 Fixed default/fixed values for attributes (looks like they 2968 2968 did not work in the last releases). 2969 2969 Completed constraints for attribute uses. 2970 - Seperated attribute derivation from attribute constraints. 2970 + Separated attribute derivation from attribute constraints. 2971 2971 Completed constraints for attribute group definitions. 2972 2972 Disallowing <import>s of schemas in no target namespace if the 2973 2973 importing schema is a chameleon schema. This contradicts 2974 2974 the way Saxon, Xerces-J, XSV and IBM's SQC works, but the 2975 - W3C XML Schema WG, thinks it is correct to dissalow such 2975 + W3C XML Schema WG, thinks it is correct to disallow such 2976 2976 imports. 2977 2977 Added cos-all-limited constraints. 2978 2978 Restructured reference resolution to model groups and element ··· 4980 4980 modules. 4981 4981 Added machanism to store element information for the 4982 4982 ancestor-or-self axis; this is needed for identity-constraints 4983 - and should be helpfull for a future streamable validation. 4983 + and should be helpful for a future streamable validation. 4984 4984 * include/libxml/xmlerror.h: Added an error code for 4985 4985 identity-constraints. 4986 4986 ··· 5639 5639 automatic API regression test tool. 5640 5640 * SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c 5641 5641 xmlstring.c: various API hardeing changes as a result of running 5642 - teh first set of automatic API regression tests. 5642 + the first set of automatic API regression tests. 5643 5643 * test/slashdot16.xml: apparently missing from CVS, commited it 5644 5644 5645 5645 Mon Nov 1 15:54:18 CET 2004 Daniel Veillard <daniel@veillard.com> ··· 5729 5729 5730 5730 Fri Oct 22 21:04:20 CEST 2004 Daniel Veillard <daniel@veillard.com> 5731 5731 5732 - * python/libxml.c: fixed a problem occuring only in x86_64 when 5732 + * python/libxml.c: fixed a problem occurring only in x86_64 when 5733 5733 very large error messages are raised to the Python handlers. 5734 5734 5735 5735 Thu Oct 21 18:03:21 CEST 2004 Daniel Veillard <daniel@veillard.com> ··· 5908 5908 5909 5909 Thu Sep 23 18:23:46 CEST 2004 Daniel Veillard <daniel@veillard.com> 5910 5910 5911 - * xmlschemastypes.c: fixing an out of bound adressing issue 5911 + * xmlschemastypes.c: fixing an out of bound addressing issue 5912 5912 5913 5913 Thu Sep 23 15:14:12 CEST 2004 Daniel Veillard <daniel@veillard.com> 5914 5914 ··· 6069 6069 of the wildcard. 6070 6070 Added a check for circular attribute group references. 6071 6071 Added a check for circular model group definition references. 6072 - Fixed a dublicate xmlParserErrors enum value - see bug #151738. 6072 + Fixed a duplicate xmlParserErrors enum value - see bug #151738. 6073 6073 6074 6074 Fri Sep 3 10:08:13 PDT 2004 William Brack <wbrack@mmmm.com.hk> 6075 6075 ··· 6275 6275 include/libxml/xmlerror.h: cleanup to avoid 'error' identifier 6276 6276 in includes #137414 6277 6277 * parser.c SAX2.c debugXML.c include/libxml/parser.h: 6278 - first version of the inplementation of parsing within 6278 + first version of the implementation of parsing within 6279 6279 the context of a node in the tree #142359, new function 6280 6280 xmlParseInNodeContext(), added support at the xmllint --shell 6281 6281 level as the "set" function ··· 6938 6938 6939 6939 Sun May 9 19:46:13 CEST 2004 Daniel Veillard <daniel@veillard.com> 6940 6940 6941 - * xmlsave.c: apply fix for XHTML1 formating from Nick Wellnhofer 6941 + * xmlsave.c: apply fix for XHTML1 formatting from Nick Wellnhofer 6942 6942 fixes bug #141266 6943 6943 * test/xhtmlcomp result//xhtmlcomp*: added the specific regression 6944 6944 test ··· 7753 7753 This is needed for XSLT to keep the stylesheet dictionary read-only 7754 7754 while being able to reuse the strings for the transformation 7755 7755 dictionary. 7756 - * xinclude.c: fixed a dictionary reference counting problem occuring 7756 + * xinclude.c: fixed a dictionary reference counting problem occurring 7757 7757 when document parsing failed. 7758 7758 * testSAX.c: adding option --repeat for timing 100times the parsing 7759 7759 * doc/* : rebuilt all the docs ··· 8947 8947 * include/libxml/parserInternals.h HTMLparser.c HTMLtree.c 8948 8948 SAX2.c catalog.c debugXML.c entities.c parser.c relaxng.c 8949 8949 testSAX.c tree.c valid.c xmlschemas.c xmlschemastypes.c 8950 - xpath.c: Changed all (?) occurences where validation macros 8950 + xpath.c: Changed all (?) occurrences where validation macros 8951 8951 (IS_xxx) had single-byte arguments to use IS_xxx_CH instead 8952 8952 (e.g. IS_BLANK changed to IS_BLANK_CH). This gets rid of 8953 8953 many warning messages on certain platforms, and also high- ··· 8972 8972 a new source, like the xmlReadxx and xmlCtxtReadxxx 8973 8973 * win32/libxml2.def.src doc/libxml2-api.xml doc/apibuild.py 8974 8974 doc/Makefile.am: regenerated the APIs 8975 - * doc/xml.html: applied a patch from Stefan Kost for namesapce docs 8975 + * doc/xml.html: applied a patch from Stefan Kost for namespace docs 8976 8976 8977 8977 Sat Oct 18 12:46:02 HKT 2003 William Brack <wbrack@mmm.com.hk> 8978 8978 ··· 9179 9179 on Windows from Jesse Pelton 9180 9180 * parser.c: tiny safety patch for xmlStrPrintf() make sure the 9181 9181 return is always zero terminated. Should also help detecting 9182 - passing wrong buffer size easilly. 9182 + passing wrong buffer size easily. 9183 9183 * result/VC/* result/valid/rss.xml.err result/valid/xlink.xml.err: 9184 9184 updated the results to follow the errors string generated by 9185 9185 last commit. ··· 9192 9192 Tue Oct 7 13:30:39 CEST 2003 Daniel Veillard <daniel@veillard.com> 9193 9193 9194 9194 * error.c relaxng.c include/libxml/xmlerror.h: switched Relax-NG 9195 - module to teh new error reporting. Better default report, adds 9195 + module to the new error reporting. Better default report, adds 9196 9196 the element associated if found, context and node are included 9197 9197 in the xmlError 9198 9198 * python/tests/reader2.py: the error messages changed. ··· 10424 10424 10425 10425 * doc/Makefile.am doc/html/*: reverted back patch for #113521, 10426 10426 due to #115104 and while fixing #115101 . HTML URLs must not 10427 - be version dependant. 10427 + be version dependent. 10428 10428 10429 10429 Fri Jun 13 12:03:30 CEST 2003 Daniel Veillard <daniel@veillard.com> 10430 10430 ··· 10627 10627 10628 10628 * python/generator.py: fixed a problem in the generator where 10629 10629 the way functions are remapped as methods on classes was 10630 - not symetric and dependant on python internal hash order, 10630 + not symmetric and dependent on python internal hash order, 10631 10631 as reported by Stéphane Bidoul 10632 10632 10633 10633 Fri Apr 25 21:52:33 MDT 2003 John Fleck <jfleck@inkstain.net> ··· 11162 11162 Mon Mar 17 16:34:07 CET 2003 Daniel Veillard <daniel@veillard.com> 11163 11163 11164 11164 * relaxng.c: fixed the last core RelaxNG bug known #107083, 11165 - shemas datatype ID/IDREF support still missing though. 11165 + schemas datatype ID/IDREF support still missing though. 11166 11166 * xmlreader.c: fix a crashing bug with prefix raised by 11167 11167 Merijn Broeren 11168 11168 * test/relaxng/testsuite.xml: augmented the testsuite with ··· 11882 11882 11883 11883 Fri Jan 10 00:16:49 CET 2003 Daniel Veillard <daniel@veillard.com> 11884 11884 11885 - * parser.c: one more IsEmptyElement crazyness, that time in 11885 + * parser.c: one more IsEmptyElement craziness, that time in 11886 11886 external parsed entities if substitution is asked. 11887 11887 * python/tests/reader3.py: added a specific test. 11888 11888 ··· 12145 12145 Mon Dec 23 16:54:22 CET 2002 Daniel Veillard <daniel@veillard.com> 12146 12146 12147 12147 * xmlreader.c: Fixed the empty node detection to avoid reporting 12148 - an inexistant close tag. 12148 + an nonexistent close tag. 12149 12149 12150 12150 Mon Dec 23 15:42:24 CET 2002 Daniel Veillard <daniel@veillard.com> 12151 12151 ··· 12482 12482 * parser.c xpath.c: fixing #96925 wich was also dependent on the 12483 12483 processing of parsed entities, and XPath computation on sustitued 12484 12484 entities. 12485 - * testXPath.c: make sure entities are substitued. 12485 + * testXPath.c: make sure entities are substituted. 12486 12486 12487 12487 Fri Nov 15 16:22:54 CET 2002 Daniel Veillard <daniel@veillard.com> 12488 12488 ··· 12673 12673 Mon Oct 21 09:57:10 CEST 2002 Daniel Veillard <daniel@veillard.com> 12674 12674 12675 12675 * parser.c: tried to fix bug #91500 where doc->children may 12676 - be overriden by a call to xmlParseBalancedChunkMemory() 12676 + be overridden by a call to xmlParseBalancedChunkMemory() 12677 12677 12678 12678 Mon Oct 21 09:04:32 CEST 2002 Daniel Veillard <daniel@veillard.com> 12679 12679 ··· 12800 12800 12801 12801 * configure.in include/libxml/xmlwin32version.h: preparing release 12802 12802 of 2.4.25 12803 - * doc/*: updated and regenerated teh docs and web pages. 12803 + * doc/*: updated and regenerated the docs and web pages. 12804 12804 12805 12805 Thu Sep 26 17:33:46 CEST 2002 Daniel Veillard <daniel@veillard.com> 12806 12806 ··· 13026 13026 13027 13027 Wed Sep 4 14:13:34 CEST 2002 Daniel Veillard <daniel@veillard.com> 13028 13028 13029 - * libxml.spec.in: fixes libary path for x86_64 AMD 13029 + * libxml.spec.in: fixes library path for x86_64 AMD 13030 13030 13031 13031 Tue Sep 3 21:14:19 MDT 2002 John Fleck <jfleck@inkstain.net> 13032 13032 ··· 13085 13085 Thu Aug 22 11:45:50 CEST 2002 Daniel Veillard <daniel@veillard.com> 13086 13086 13087 13087 * python/Makefile.am: typo in target name resulted in libxml2.py 13088 - to not be rebuilt. fixed DESTDIR similary to the libxslt one. 13088 + to not be rebuilt. fixed DESTDIR similarly to the libxslt one. 13089 13089 13090 13090 Thu Aug 22 09:15:00 CEST 2002 Daniel Veillard <daniel@veillard.com> 13091 13091 ··· 14044 14044 Thu Mar 7 12:19:36 CET 2002 Daniel Veillard <daniel@veillard.com> 14045 14045 14046 14046 * configure.in xmllint.c: trying to fix #71457 for timing 14047 - precision when gettimeofday() is not availble but ftime() is 14047 + precision when gettimeofday() is not available but ftime() is 14048 14048 14049 14049 Thu Mar 7 11:24:02 CET 2002 Daniel Veillard <daniel@veillard.com> 14050 14050 ··· 14208 14208 when a document is standalone seems correctly handled. There 14209 14209 is a couple of open issues left which need consideration especially 14210 14210 PE93 on external unparsed entities and standalone status. 14211 - Ran 1819 tests: 1817 suceeded, 2 failed and 0 generated an error in 8.26 s. 14211 + Ran 1819 tests: 1817 succeeded, 2 failed and 0 generated an error in 8.26 s. 14212 14212 The 2 tests left failing are actually in error. Cleanup done. 14213 14213 14214 14214 Tue Feb 19 15:17:02 CET 2002 Daniel Veillard <daniel@veillard.com> ··· 14225 14225 14226 14226 * parser.c valid.c: a couple of errors were reported but not 14227 14227 saved back as such in the parsing context. Down to 1% failure rate 14228 - Ran 1819 tests: 1801 suceeded, 18 failed and 0 generated an error 14228 + Ran 1819 tests: 1801 succeeded, 18 failed and 0 generated an error 14229 14229 14230 14230 Mon Feb 18 20:16:15 CET 2002 Daniel Veillard <daniel@veillard.com> 14231 14231 ··· 14266 14266 * check-xml-test-suite.py: improved the behaviour a bit as 14267 14267 well as the logs 14268 14268 * parser.c valid.c SAX.c: fixed a few more bugs 14269 - "Ran 1819 tests: 1778 suceeded, 41 failed, and 0 generated an error" 14269 + "Ran 1819 tests: 1778 succeeded, 41 failed, and 0 generated an error" 14270 14270 14271 14271 Sun Feb 17 20:41:37 CET 2002 Daniel Veillard <daniel@veillard.com> 14272 14272 ··· 14453 14453 context, allow to switch on and check validity 14454 14454 * python/tests/Makefile.am python/tests/error.py 14455 14455 python/tests/invalid.xml python/tests/valid.xml 14456 - python/tests/validate.py: attded more test and and added error.py 14456 + python/tests/validate.py: added more test and added error.py 14457 14457 which I forgot to commit in the last step 14458 14458 14459 14459 Sun Feb 3 16:03:55 CET 2002 Daniel Veillard <daniel@veillard.com> ··· 14576 14576 Wed Jan 23 15:14:22 CET 2002 Daniel Veillard <daniel@veillard.com> 14577 14577 14578 14578 * parserInternals.h: Greg Sjaardema suggested to use an 14579 - eponential buffer groth policy in xmlParserAddNodeInfo() 14579 + exponential buffer growth policy in xmlParserAddNodeInfo() 14580 14580 14581 14581 Wed Jan 23 13:32:40 CET 2002 Daniel Veillard <daniel@veillard.com> 14582 14582 ··· 14660 14660 14661 14661 Fri Jan 18 17:22:50 CET 2002 Daniel Veillard <daniel@veillard.com> 14662 14662 14663 - * globals.c xmlIO.c xmlcatalog.c: removed the last occurences 14663 + * globals.c xmlIO.c xmlcatalog.c: removed the last occurrences 14664 14664 of strdup usage in the code 14665 14665 14666 14666 Fri Jan 18 12:47:15 CET 2002 Daniel Veillard <daniel@veillard.com> ··· 15488 15488 Tue Sep 11 11:25:36 CEST 2001 Daniel Veillard <daniel@veillard.com> 15489 15489 15490 15490 * parser.c result/noent/wml.xml: fixed bug #59981 related 15491 - to handling of '&' in attributes when entities are substitued 15491 + to handling of '&' in attributes when entities are substituted 15492 15492 15493 15493 Mon Sep 10 22:14:42 CEST 2001 Daniel Veillard <daniel@veillard.com> 15494 15494 ··· 16120 16120 16121 16121 * configure.in doc/xml.html include/libxml/xmlwin32version.h: 16122 16122 release of 2.3.12 16123 - * parser.c: make an error message if unknow entities in all cases 16123 + * parser.c: make an error message if unknown entities in all cases 16124 16124 16125 16125 Tue Jun 26 09:46:29 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> 16126 16126 ··· 16943 16943 Wed Apr 18 15:06:30 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> 16944 16944 16945 16945 * debugXML.c hash.c tree.h valid.c : some changes related to 16946 - the validation suport to improve speed with DocBook 16946 + the validation support to improve speed with DocBook 16947 16947 * result/VC/OneID2 result/VC/OneID3 : this slightly changes 16948 16948 the way validation errors get reported 16949 16949 ··· 17003 17003 * xpath.c: trying to get 52979 solved 17004 17004 * tree.c result/ result/noent/: trying to get 52712 solved, this 17005 17005 also made me clean up the fact that XML output in general should 17006 - not add formating blanks by default, this changed the output of 17006 + not add formatting blanks by default, this changed the output of 17007 17007 a few tests 17008 17008 17009 17009 Tue Apr 10 16:30:20 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> ··· 17219 17219 17220 17220 * parser.c SAX.c: the new content parsing code raised an 17221 17221 ugly bug in the characters() SAX callback. Found it 17222 - just because of strangeness in XSLT XML Rec ouptut :-( 17222 + just because of strangeness in XSLT XML Rec output :-( 17223 17223 17224 17224 Wed Mar 7 16:50:22 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> 17225 17225 ··· 17541 17541 17542 17542 Mon Jan 22 11:43:21 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> 17543 17543 17544 - * xpath.c: when copying a XSLT tree object teh tree need to be copied 17544 + * xpath.c: when copying a XSLT tree object the tree need to be copied 17545 17545 too, and deallocation need to occur the same way. 17546 17546 17547 17547 Mon Jan 22 10:35:40 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> 17548 17548 17549 17549 * xpathInternals.h xpath.[ch] debugXML.c: added the XPATH_XSLT_TREE 17550 - type correponding to an XSLT result tree fragment. Share most 17550 + type corresponding to an XSLT result tree fragment. Share most 17551 17551 of the data format with node set, as well as operators. 17552 17552 * HTMLtree.c: added a newline at the end of the doctype output 17553 17553 whe this one is not present initially. ··· 17904 17904 Sun Oct 15 16:21:27 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> 17905 17905 17906 17906 * SAX.c: HTML attributes need normalization too (Bjorn Reese) 17907 - * HTMLparser.[ch]: addded htmlIsScriptAttribute() 17907 + * HTMLparser.[ch]: added htmlIsScriptAttribute() 17908 17908 17909 17909 Sun Oct 15 13:18:36 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> 17910 17910 ··· 18010 18010 * include/Makefile.am include/win32config.h: new directory 18011 18011 for includes 18012 18012 * win32/Makefile.mingw win32/README.MSDev win32/libxml2/libxml2.dsp 18013 - updated teh makefiles and instructions for WIN32 18013 + updated the makefiles and instructions for WIN32 18014 18014 * xpath.c: small fixes 18015 18015 * test/XPath/ results/XPath: updated the testcases and results 18016 18016 * HTMLparser.c nanohttp.c testXPath.c: incorporated provided or ··· 18255 18255 patches from Wayne Davison <wayned@users.sourceforge.net>, 18256 18256 adding htmlEncodeEntities() 18257 18257 * HTMLparser.c: fixed an ignorable white space detection bug 18258 - occuring when parsing with SAX only 18258 + occurring when parsing with SAX only 18259 18259 * result/HTML/*.sax: updated since the output is now HTML 18260 18260 encoded... 18261 18261 ··· 18420 18420 when using Sun Pro cc compiler 18421 18421 * xpath.c : cleanup memleaks 18422 18422 * nanoftp.c : added a TESTING preprocessor flag for standalong 18423 - compile so that people can report bugs more easilly 18423 + compile so that people can report bugs more easily 18424 18424 * nanohttp.c : ditched socklen_t which was a portability mess 18425 18425 and replaced it with unsigned int. 18426 18426 * tree.[ch]: added xmlHasProp() ··· 18594 18594 Makefile.am : added compile-time customization of libxml 18595 18595 --with-ftp --with-http --with-html --with-xpath --with-debug 18596 18596 --with-mem-debug 18597 - * *.[ch] autoconf.sh : moved to an absolute adressing of includes : 18597 + * *.[ch] autoconf.sh : moved to an absolute addressing of includes : 18598 18598 #include <libxml/xxx.h> I hope it won't break too much stuff 18599 18599 and will be manageable in the future... 18600 18600 * xmllint.c Makefile.am libxml.spec.in : renamed tester.c to xmllint.c ··· 18625 18625 libxml default allocation function with another set (like gmalloc/ 18626 18626 gfree). 18627 18627 * Makefile.am, uri.c, uri.h: added a set of functions to do 18628 - exact (litteraly copied from the RFC 2396 productions) parsing 18628 + exact (literally copied from the RFC 2396 productions) parsing 18629 18629 and handling of URI. Will be needed for XLink, one XML WFC, 18630 18630 XML Base and reused in the nano[ftp/http] modules. Still work 18631 18631 to be done. ··· 18688 18688 18689 18689 * nanoftp.c nanohttp.c tree.c HTMLtree.[ch] debugXML.c xpath.c: Fixed 18690 18690 compilation warnings on various platforms. 18691 - * parser.c: Fixed #5281 validity error callbacks are now desactived 18691 + * parser.c: Fixed #5281 validity error callbacks are now deactivated 18692 18692 by default if not validating. 18693 18693 18694 18694 Thu Feb 3 13:46:14 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org> ··· 19125 19125 19126 19126 * parser.h: modified the parser context struct to regain 1.4.0 19127 19127 binary compatibility 19128 - * parser.c, xml-error.h: added errno ot teh context and defined 19128 + * parser.c, xml-error.h: added errno to the context and defined 19129 19129 a set of errors values with update of errno 19130 19130 * nanohttp.[ch]: minimalist HTTP front-end for fetching remote 19131 19131 DTDs and entities ··· 19562 19562 19563 19563 Sat Oct 24 14:23:51 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org> 19564 19564 19565 - * parser.c: Set up the fonctions comment block, boring but useful. 19565 + * parser.c: Set up the functions comment block, boring but useful. 19566 19566 * parser.h, SAX.c, parser.c: now attributes are processed through 19567 19567 the SAX interface. The problem is that my SAX interface diverged 19568 19568 quite a bit from the original one, well this is not an official ··· 19571 19571 Tue Oct 20 02:11:21 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org> 19572 19572 19573 19573 * SAX.c, entities.c, tree.c, encoding.c, error.c: Set up the 19574 - fonctions comment block, boring but useful. 19574 + functions comment block, boring but useful. 19575 19575 19576 19576 Sun Oct 18 20:40:58 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org> 19577 19577
+19 -12
sdk/lib/3rdparty/libxml2/HTMLparser.c
··· 317 317 318 318 #define SKIP_BLANKS htmlSkipBlankChars(ctxt) 319 319 320 - /* Inported from XML */ 320 + /* Imported from XML */ 321 321 322 322 /* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */ 323 323 #define CUR ((int) (*ctxt->input->cur)) ··· 537 537 encoding_error: 538 538 /* 539 539 * If we detect an UTF8 error that probably mean that the 540 - * input encoding didn't get properly advertized in the 540 + * input encoding didn't get properly advertised in the 541 541 * declaration header. Report the error and switch the encoding 542 542 * to ISO-Latin-1 (if you don't like this policy, just declare the 543 543 * encoding !) ··· 602 602 ************************************************************************/ 603 603 604 604 /* 605 - * Start Tag: 1 means the start tag can be ommited 606 - * End Tag: 1 means the end tag can be ommited 605 + * Start Tag: 1 means the start tag can be omitted 606 + * End Tag: 1 means the end tag can be omitted 607 607 * 2 means it's forbidden (empty elements) 608 608 * 3 means the tag is stylistic and should be closed easily 609 609 * Depr: this element is deprecated ··· 1342 1342 if (xmlStrEqual(newtag, ctxt->nameTab[i])) 1343 1343 break; 1344 1344 /* 1345 - * A missplaced endtag can only close elements with lower 1345 + * A misplaced endtag can only close elements with lower 1346 1346 * or equal priority, so if we find an element with higher 1347 1347 * priority before we find an element with 1348 1348 * matching name, we just ignore this endtag ··· 2176 2176 * * 2177 2177 ************************************************************************/ 2178 2178 2179 + #ifdef LIBXML_PUSH_ENABLED 2179 2180 /** 2180 2181 * htmlNewInputStream: 2181 2182 * @ctxt: an HTML parser context ··· 2207 2208 input->length = 0; 2208 2209 return(input); 2209 2210 } 2211 + #endif 2210 2212 2211 2213 2212 2214 /************************************************************************ ··· 2216 2218 ************************************************************************/ 2217 2219 /* 2218 2220 * all tags allowing pc data from the html 4.01 loose dtd 2219 - * NOTE: it might be more apropriate to integrate this information 2221 + * NOTE: it might be more appropriate to integrate this information 2220 2222 * into the html40ElementTable array but I don't want to risk any 2221 - * binary incomptibility 2223 + * binary incompatibility 2222 2224 */ 2223 2225 static const char *allowPCData[] = { 2224 2226 "a", "abbr", "acronym", "address", "applet", "b", "bdo", "big", ··· 2959 2961 } 2960 2962 COPY_BUF(l,buf,nbchar,cur); 2961 2963 if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { 2964 + buf[nbchar] = 0; 2962 2965 if (ctxt->sax->cdataBlock!= NULL) { 2963 2966 /* 2964 2967 * Insert as CDATA, which is the same as HTML_PRESERVE_NODE ··· 2983 2986 } 2984 2987 2985 2988 if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { 2989 + buf[nbchar] = 0; 2986 2990 if (ctxt->sax->cdataBlock!= NULL) { 2987 2991 /* 2988 2992 * Insert as CDATA, which is the same as HTML_PRESERVE_NODE ··· 3028 3032 COPY_BUF(l,buf,nbchar,cur); 3029 3033 } 3030 3034 if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { 3035 + buf[nbchar] = 0; 3036 + 3031 3037 /* 3032 3038 * Ok the segment is to be consumed as chars. 3033 3039 */ ··· 5762 5768 break; 5763 5769 } 5764 5770 case XML_PARSER_CONTENT: { 5771 + xmlChar chr[2] = { 0, 0 }; 5765 5772 long cons; 5773 + 5766 5774 /* 5767 5775 * Handle preparsed entities and charRef 5768 5776 */ 5769 5777 if (ctxt->token != 0) { 5770 - xmlChar chr[2] = { 0 , 0 } ; 5771 - 5772 5778 chr[0] = (xmlChar) ctxt->token; 5773 5779 htmlCheckParagraph(ctxt); 5774 5780 if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) ··· 5780 5786 cur = in->cur[0]; 5781 5787 if ((cur != '<') && (cur != '&')) { 5782 5788 if (ctxt->sax != NULL) { 5789 + chr[0] = cur; 5783 5790 if (IS_BLANK_CH(cur)) { 5784 5791 if (ctxt->keepBlanks) { 5785 5792 if (ctxt->sax->characters != NULL) 5786 5793 ctxt->sax->characters( 5787 - ctxt->userData, &in->cur[0], 1); 5794 + ctxt->userData, chr, 1); 5788 5795 } else { 5789 5796 if (ctxt->sax->ignorableWhitespace != NULL) 5790 5797 ctxt->sax->ignorableWhitespace( 5791 - ctxt->userData, &in->cur[0], 1); 5798 + ctxt->userData, chr, 1); 5792 5799 } 5793 5800 } else { 5794 5801 htmlCheckParagraph(ctxt); 5795 5802 if (ctxt->sax->characters != NULL) 5796 5803 ctxt->sax->characters( 5797 - ctxt->userData, &in->cur[0], 1); 5804 + ctxt->userData, chr, 1); 5798 5805 } 5799 5806 } 5800 5807 ctxt->token = 0;
+1 -1
sdk/lib/3rdparty/libxml2/HTMLtree.c
··· 1048 1048 * @cur: the document 1049 1049 * @encoding: the encoding string 1050 1050 * 1051 - * Dump an HTML document. Formating return/spaces are added. 1051 + * Dump an HTML document. Formatting return/spaces are added. 1052 1052 */ 1053 1053 void 1054 1054 htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
+458 -15
sdk/lib/3rdparty/libxml2/NEWS
··· 8 8 ChangeLog.html 9 9 describes the recents commits 10 10 to the GIT at 11 - http://git.gnome.org/browse/libxml2/ 11 + https://gitlab.gnome.org/GNOME/libxml2 12 12 code base.Here is the list of public releases: 13 + v2.9.9: Jan 03 2019: 14 + - Security: 15 + CVE-2018-9251 CVE-2018-14567 Fix infinite loop in LZMA decompression (Nick Wellnhofer), 16 + CVE-2018-14404 Fix nullptr deref with XPath logic ops (Nick Wellnhofer), 17 + 18 + - Documentation: 19 + reader: Fix documentation comment (Mohammed Sadiq) 20 + 21 + - Portability: 22 + Fix MSVC build with lzma (Nick Wellnhofer), 23 + Variables need 'extern' in static lib on Cygwin (Michael Haubenwallner), 24 + Really declare dllexport/dllimport for Cygwin (Michael Haubenwallner), 25 + Merge branch 'patch-2' into 'master' (Nick Wellnhofer), 26 + Change dir to $THEDIR after ACLOCAL_PATH check autoreconf creates aclocal.m4 in $srcdir (Vitaly Buka), 27 + Improve error message if pkg.m4 couldn't be found (Nick Wellnhofer), 28 + NaN and Inf fixes for pre-C99 compilers (Nick Wellnhofer) 29 + 30 + - Bug Fixes: 31 + Revert "Support xmlTextReaderNextSibling w/o preparsed doc" (Nick Wellnhofer), 32 + Fix building relative URIs (Thomas Holder), 33 + Problem with data in interleave in RelaxNG validation (Nikolai Weibull), 34 + Fix memory leak in xmlSwitchInputEncodingInt error path (Nick Wellnhofer), 35 + Set doc on element obtained from freeElems (Nick Wellnhofer), 36 + Fix HTML serialization with UTF-8 encoding (Nick Wellnhofer), 37 + Use actual doc in xmlTextReaderRead*Xml (Nick Wellnhofer), 38 + Unlink node before freeing it in xmlSAX2StartElement (Nick Wellnhofer), 39 + Check return value of nodePush in xmlSAX2StartElement (Nick Wellnhofer), 40 + Free input buffer in xmlHaltParser (Nick Wellnhofer), 41 + Reset HTML parser input pointers on encoding failure (Nick Wellnhofer), 42 + Don't run icu_parse_test if EUC-JP is unsupported (Nick Wellnhofer), 43 + Fix xmlSchemaValidCtxtPtr reuse memory leak (Greg Hildstrom), 44 + Fix xmlTextReaderNext with preparsed document (Felix Bünemann), 45 + Remove stray character from comment (Nick Wellnhofer), 46 + Remove a misleading line from xmlCharEncOutput (Andrey Bienkowski), 47 + HTML noscript should not close p (Daniel Veillard), 48 + Don't change context node in xmlXPathRoot (Nick Wellnhofer), 49 + Stop using XPATH_OP_RESET (Nick Wellnhofer), 50 + Revert "Change calls to xmlCharEncInput to set flush false" (Nick Wellnhofer) 51 + 52 + - Improvements: 53 + Fix "Problem with data in interleave in RelaxNG validation" (Nikolai Weibull), 54 + cleanup: remove some unreachable code (Thomas Holder), 55 + add --relative to testURI (Thomas Holder), 56 + Remove redefined starts and defines inside include elements (Nikolai Weibull), 57 + Allow choice within choice in nameClass in RELAX NG (Nikolai Weibull), 58 + Look inside divs for starts and defines inside include (Nikolai Weibull), 59 + Add compile and libxml2-config.cmake to .gitignore (Nikolai Weibull), 60 + Stop using doc->charset outside parser code (Nick Wellnhofer), 61 + Add newlines to 'xmllint --xpath' output (Nick Wellnhofer), 62 + Don't include SAX.h from globals.h (Nick Wellnhofer), 63 + Support xmlTextReaderNextSibling w/o preparsed doc (Felix Bünemann), 64 + Don't instruct user to run make when autogen.sh failed (林博仁(Buo-ren Lin)), 65 + Run Travis ASan tests with "sudo: required" (Nick Wellnhofer), 66 + Improve restoring of context size and position (Nick Wellnhofer), 67 + Simplify and harden nodeset filtering (Nick Wellnhofer), 68 + Avoid unnecessary backups of the context node (Nick Wellnhofer), 69 + Fix inconsistency in xmlXPathIsInf (Nick Wellnhofer) 70 + 71 + - Cleanups: 72 + 73 + 74 + 75 + v2.9.8: Mar 05 2018: 76 + - Portability: 77 + python: remove single use of _PyVerify_fd (Patrick Welche), 78 + Build more test executables on Windows/MSVC (Nick Wellnhofer), 79 + Stop including ansidecl.h (Nick Wellnhofer), 80 + Fix libz and liblzma detection (Nick Wellnhofer), 81 + Revert "Compile testapi with -Wno-unused-function" (Nick Wellnhofer) 82 + 83 + - Bug Fixes: 84 + Fix xmlParserEntityCheck (Nick Wellnhofer), 85 + Halt parser in case of encoding error (Nick Wellnhofer), 86 + Clear entity content in case of errors (Nick Wellnhofer), 87 + Change calls to xmlCharEncInput to set flush false when not final call. Having flush incorrectly set to true causes errors for ICU. (Joel Hockey), 88 + Fix buffer over-read in xmlParseNCNameComplex (Nick Wellnhofer), 89 + Fix ICU library filenames on Windows/MSVC (Nick Wellnhofer), 90 + Fix xmlXPathIsNaN broken by recent commit (Nick Wellnhofer), 91 + Fix -Wenum-compare warnings (Nick Wellnhofer), 92 + Fix callback signature in testapi.c (Nick Wellnhofer), 93 + Fix unused parameter warning without ICU (Nick Wellnhofer), 94 + Fix IO callback signatures (Nick Wellnhofer), 95 + Fix misc callback signatures (Nick Wellnhofer), 96 + Fix list callback signatures (Nick Wellnhofer), 97 + Fix hash callback signatures (Nick Wellnhofer), 98 + Refactor name and type signature for xmlNop (Vlad Tsyrklevich), 99 + Fixed ICU to set flush correctly and provide pivot buffer. (Joel Hockey), 100 + Skip EBCDIC tests if EBCDIC isn't supported (Nick Wellnhofer) 101 + 102 + - Improvements: 103 + Disable pointer-overflow UBSan checks under Travis (Nick Wellnhofer), 104 + Improve handling of context input_id (Daniel Veillard), 105 + Add resource file to Windows DLL (ccpaging), 106 + Run Travis tests with -Werror (Nick Wellnhofer), 107 + Build with "-Wall -Wextra" (Nick Wellnhofer), 108 + Fix -Wtautological-pointer-compare warnings (Nick Wellnhofer), 109 + Remove unused AC_CHECKs (Nick Wellnhofer), 110 + Update information about contributing (Nick Wellnhofer), 111 + Fix -Wmisleading-indentation warnings (Nick Wellnhofer), 112 + Don't touch CFLAGS in configure.ac (Nick Wellnhofer), 113 + Ignore function pointer cast warnings (Nick Wellnhofer), 114 + Simplify XPath NaN, inf and -0 handling (Nick Wellnhofer), 115 + Introduce xmlPosixStrdup and update xmlMemStrdup (Nick Wellnhofer), 116 + Add test for ICU flush and pivot buffer (Nick Wellnhofer), 117 + Compile testapi with -Wno-unused-function (Nick Wellnhofer) 118 + 119 + 120 + 121 + 2.9.7: Nov 02 2017: 122 + - Documentation: 123 + xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný) 124 + 125 + - Portability: 126 + Fix deprecated Travis compiler flag (Nick Wellnhofer), 127 + Add declaration for DllMain (J. Peter Mugaas), 128 + Fix preprocessor conditional in threads.h (J. Peter Mugaas), 129 + Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas), 130 + Fix macro redefinition warning (J. Peter Mugaas), 131 + Default to native threads on MinGW-w64 (Nick Wellnhofer), 132 + Simplify Windows IO functions (Nick Wellnhofer), 133 + Fix runtest on Windows (Nick Wellnhofer), 134 + socklen_t is always int on Windows (Nick Wellnhofer), 135 + Don't redefine socket error codes on Windows (Nick Wellnhofer), 136 + Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer), 137 + Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer) 138 + 139 + - Bug Fixes: 140 + xmlcatalog: restore ability to query system catalog easily (Jan Pokorný), 141 + Fix comparison of nodesets to strings (Nick Wellnhofer) 142 + 143 + - Improvements: 144 + Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer), 145 + Fix mixed decls and code in timsort.h (Nick Wellnhofer), 146 + Rework handling of return values in thread tests (Nick Wellnhofer), 147 + Fix unused variable warnings in testrecurse (Nick Wellnhofer), 148 + Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas), 149 + Upgrade timsort.h to latest revision (Nick Wellnhofer), 150 + Increase warning level to /W3 under MSVC (Nick Wellnhofer), 151 + Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer), 152 + Update .gitignore for Windows (Nick Wellnhofer), 153 + Fix unused variable warnings in nanohttp.c (Nick Wellnhofer), 154 + Fix the Windows header mess (Nick Wellnhofer), 155 + Don't include winsock2.h in xmllint.c (Nick Wellnhofer), 156 + Remove generated file python/setup.py from version control (Nick Wellnhofer), 157 + Use __linux__ macro in generated code (Nick Wellnhofer) 158 + 159 + 160 + 161 + v2.9.6: Oct 06 2017: 162 + - Portability: 163 + Change preprocessor OS tests to __linux__ (Nick Wellnhofer) 164 + 165 + - Bug Fixes: 166 + Fix XPath stack frame logic (Nick Wellnhofer), 167 + Report undefined XPath variable error message (Nick Wellnhofer), 168 + Fix regression with librsvg (Nick Wellnhofer), 169 + Handle more invalid entity values in recovery mode (Nick Wellnhofer), 170 + Fix structured validation errors (Nick Wellnhofer), 171 + Fix memory leak in LZMA decompressor (Nick Wellnhofer), 172 + Set memory limit for LZMA decompression (Nick Wellnhofer), 173 + Handle illegal entity values in recovery mode (Nick Wellnhofer), 174 + Fix debug dump of streaming XPath expressions (Nick Wellnhofer), 175 + Fix memory leak in nanoftp (Nick Wellnhofer), 176 + Fix memory leaks in SAX1 parser (Nick Wellnhofer) 177 + 178 + 179 + 180 + v2.9.5: Sep 04 2017: 181 + - Security: 182 + Detect infinite recursion in parameter entities (Nick Wellnhofer), 183 + Fix handling of parameter-entity references (Nick Wellnhofer), 184 + Disallow namespace nodes in XPointer ranges (Nick Wellnhofer), 185 + Fix XPointer paths beginning with range-to (Nick Wellnhofer) 186 + 187 + - Documentation: 188 + Documentation fixes (Nick Wellnhofer), 189 + Spelling and grammar fixes (Nick Wellnhofer) 190 + 191 + - Portability: 192 + Adding README.zOS to list of extra files for the release (Daniel Veillard), 193 + Description of work needed to compile on zOS (Stéphane Michaut), 194 + Porting libxml2 on zOS encoding of code (Stéphane Michaut), 195 + small changes for OS/400 (Patrick Monnerat), 196 + relaxng.c, xmlschemas.c: Fix build on pre-C99 compilers (Chun-wei Fan) 197 + 198 + - Bug Fixes: 199 + Problem resolving relative URIs (Daniel Veillard), 200 + Fix unwanted warnings when switching encodings (Nick Wellnhofer), 201 + Fix signature of xmlSchemaAugmentImportedIDC (Daniel Veillard), 202 + Heap-buffer-overflow read of size 1 in xmlFAParsePosCharGroup (David Kilzer), 203 + Fix NULL pointer deref in xmlFAParseCharClassEsc (Nick Wellnhofer), 204 + Fix infinite loops with push parser in recovery mode (Nick Wellnhofer), 205 + Send xmllint usage error to stderr (Nick Wellnhofer), 206 + Fix NULL deref in xmlParseExternalEntityPrivate (Nick Wellnhofer), 207 + Make sure not to call IS_BLANK_CH when parsing the DTD (Nick Wellnhofer), 208 + Fix xmlHaltParser (Nick Wellnhofer), 209 + Fix pathological performance when outputting charrefs (Nick Wellnhofer), 210 + Fix invalid-source-encoding warnings in testWriter.c (Nick Wellnhofer), 211 + Fix duplicate SAX callbacks for entity content (David Kilzer), 212 + Treat URIs with scheme as absolute in C14N (Nick Wellnhofer), 213 + Fix copy-paste errors in error messages (Nick Wellnhofer), 214 + Fix sanity check in htmlParseNameComplex (Nick Wellnhofer), 215 + Fix potential infinite loop in xmlStringLenDecodeEntities (Nick Wellnhofer), 216 + Reset parser input pointers on encoding failure (Nick Wellnhofer), 217 + Fix memory leak in xmlParseEntityDecl error path (Nick Wellnhofer), 218 + Fix xmlBuildRelativeURI for URIs starting with './' (Nick Wellnhofer), 219 + Fix type confusion in xmlValidateOneNamespace (Nick Wellnhofer), 220 + Fix memory leak in xmlStringLenGetNodeList (Nick Wellnhofer), 221 + Fix NULL pointer deref in xmlDumpElementContent (Daniel Veillard), 222 + Fix memory leak in xmlBufAttrSerializeTxtContent (Nick Wellnhofer), 223 + Stop parser on unsupported encodings (Nick Wellnhofer), 224 + Check for integer overflow in memory debug code (Nick Wellnhofer), 225 + Fix buffer size checks in xmlSnprintfElementContent (Nick Wellnhofer), 226 + Avoid reparsing in xmlParseStartTag2 (Nick Wellnhofer), 227 + Fix undefined behavior in xmlRegExecPushStringInternal (Nick Wellnhofer), 228 + Check XPath exponents for overflow (Nick Wellnhofer), 229 + Check for overflow in xmlXPathIsPositionalPredicate (Nick Wellnhofer), 230 + Fix spurious error message (Nick Wellnhofer), 231 + Fix memory leak in xmlCanonicPath (Nick Wellnhofer), 232 + Fix memory leak in xmlXPathCompareNodeSetValue (Nick Wellnhofer), 233 + Fix memory leak in pattern error path (Nick Wellnhofer), 234 + Fix memory leak in parser error path (Nick Wellnhofer), 235 + Fix memory leaks in XPointer error paths (Nick Wellnhofer), 236 + Fix memory leak in xmlXPathNodeSetMergeAndClear (Nick Wellnhofer), 237 + Fix memory leak in XPath filter optimizations (Nick Wellnhofer), 238 + Fix memory leaks in XPath error paths (Nick Wellnhofer), 239 + Do not leak the new CData node if adding fails (David Tardon), 240 + Prevent unwanted external entity reference (Neel Mehta), 241 + Increase buffer space for port in HTTP redirect support (Daniel Veillard), 242 + Fix more NULL pointer derefs in xpointer.c (Nick Wellnhofer), 243 + Avoid function/data pointer conversion in xpath.c (Nick Wellnhofer), 244 + Fix format string warnings (Nick Wellnhofer), 245 + Disallow namespace nodes in XPointer points (Nick Wellnhofer), 246 + Fix comparison with root node in xmlXPathCmpNodes (Nick Wellnhofer), 247 + Fix attribute decoding during XML schema validation (Alex Henrie), 248 + Fix NULL pointer deref in XPointer range-to (Nick Wellnhofer) 249 + 250 + - Improvements: 251 + Updating the spec file to reflect Fedora 24 (Daniel Veillard), 252 + Add const in five places to move 1 KiB to .rdata (Bruce Dawson), 253 + Fix missing part of comment for function xmlXPathEvalExpression() (Daniel Veillard), 254 + Get rid of "blanks wrapper" for parameter entities (Nick Wellnhofer), 255 + Simplify handling of parameter entity references (Nick Wellnhofer), 256 + Deduplicate code in encoding.c (Nick Wellnhofer), 257 + Make HTML parser functions take const pointers (Nick Wellnhofer), 258 + Build test programs only when needed (Nick Wellnhofer), 259 + Fix doc/examples/index.py (Nick Wellnhofer), 260 + Fix compiler warnings in threads.c (Nick Wellnhofer), 261 + Fix empty-body warning in nanohttp.c (Nick Wellnhofer), 262 + Fix cast-align warnings (Nick Wellnhofer), 263 + Fix unused-parameter warnings (Nick Wellnhofer), 264 + Rework entity boundary checks (Nick Wellnhofer), 265 + Don't switch encoding for internal parameter entities (Nick Wellnhofer), 266 + Merge duplicate code paths handling PE references (Nick Wellnhofer), 267 + Test SAX2 callbacks with entity substitution (Nick Wellnhofer), 268 + Support catalog and threads tests under --without-sax1 (Nick Wellnhofer), 269 + Misc fixes for 'make tests' (Nick Wellnhofer), 270 + Initialize keepBlanks in HTML parser (Nick Wellnhofer), 271 + Add test cases for bug 758518 (David Kilzer), 272 + Fix compiler warning in htmlParseElementInternal (Nick Wellnhofer), 273 + Remove useless check in xmlParseAttributeListDecl (Nick Wellnhofer), 274 + Allow zero sized memory input buffers (Nick Wellnhofer), 275 + Add TODO comment in xmlSwitchEncoding (Nick Wellnhofer), 276 + Check for integer overflow in xmlXPathFormatNumber (Nick Wellnhofer), 277 + Make Travis print UBSan stacktraces (Nick Wellnhofer), 278 + Add .travis.yml (Nick Wellnhofer), 279 + Fix expected error output in Python tests (Nick Wellnhofer), 280 + Simplify control flow in xmlParseStartTag2 (Nick Wellnhofer), 281 + Disable LeakSanitizer when running API tests (Nick Wellnhofer), 282 + Avoid out-of-bound array access in API tests (Nick Wellnhofer), 283 + Avoid spurious UBSan errors in parser.c (Nick Wellnhofer), 284 + Parse small XPath numbers more accurately (Nick Wellnhofer), 285 + Rework XPath rounding functions (Nick Wellnhofer), 286 + Fix white space in test output (Nick Wellnhofer), 287 + Fix axis traversal from attribute and namespace nodes (Nick Wellnhofer), 288 + Check for trailing characters in XPath expressions earlier (Nick Wellnhofer), 289 + Rework final handling of XPath results (Nick Wellnhofer), 290 + Make xmlXPathEvalExpression call xmlXPathEval (Nick Wellnhofer), 291 + Remove unused variables (Nick Wellnhofer), 292 + Don't print generic error messages in XPath tests (Nick Wellnhofer) 293 + 294 + - Cleanups: 295 + Fix a couple of misleading indentation errors (Daniel Veillard), 296 + Remove unnecessary calls to xmlPopInput (Nick Wellnhofer) 297 + 298 + 299 + 300 + 2.9.4: May 23 2016: 301 + - Security: 302 + More format string warnings with possible format string vulnerability (David Kilzer), 303 + Avoid building recursive entities (Daniel Veillard), 304 + Heap-based buffer overread in htmlCurrentChar (Pranjal Jumde), 305 + Heap-based buffer-underreads due to xmlParseName (David Kilzer), 306 + Heap use-after-free in xmlSAX2AttributeNs (Pranjal Jumde), 307 + Heap use-after-free in htmlParsePubidLiteral and htmlParseSystemiteral (Pranjal Jumde), 308 + Fix some format string warnings with possible format string vulnerability (David Kilzer), 309 + Detect change of encoding when parsing HTML names (Hugh Davenport), 310 + Fix inappropriate fetch of entities content (Daniel Veillard), 311 + Bug 759398: Heap use-after-free in xmlDictComputeFastKey <https://bugzilla.gnome.org/show_bug.cgi?id=759398> (Pranjal Jumde), 312 + Bug 758605: Heap-based buffer overread in xmlDictAddString <https://bugzilla.gnome.org/show_bug.cgi?id=758605> (Pranjal Jumde), 313 + Bug 758588: Heap-based buffer overread in xmlParserPrintFileContextInternal <https://bugzilla.gnome.org/show_bug.cgi?id=758588> (David Kilzer), 314 + Bug 757711: heap-buffer-overflow in xmlFAParsePosCharGroup <https://bugzilla.gnome.org/show_bug.cgi?id=757711> (Pranjal Jumde), 315 + Add missing increments of recursion depth counter to XML parser. (Peter Simons) 316 + 317 + - Documentation: 318 + Fix typo: s{ ec -> cr }cipt (Jan Pokorný), 319 + Fix typos: dictio{ nn -> n }ar{y,ies} (Jan Pokorný), 320 + Fix typos: PATH_{ SEAPARATOR -> SEPARATOR } (Jan Pokorný), 321 + Correct a typo. (Shlomi Fish) 322 + 323 + - Portability: 324 + Correct the usage of LDFLAGS (Mattias Hansson), 325 + Revert the use of SAVE_LDFLAGS in configure.ac (Mattias Hansson), 326 + libxml2 hardcodes -L/lib in zlib/lzma tests which breaks cross-compiles (Mike Frysinger), 327 + Fix apibuild for a recently added construct (Daniel Veillard), 328 + Use pkg-config to locate zlib when possible (Stewart Brodie), 329 + Use pkg-config to locate ICU when possible (Stewart Brodie), 330 + Portability to non C99 compliant compilers (Patrick Monnerat), 331 + dict.h: Move xmlDictPtr definition before includes to allow direct inclusion. (Patrick Monnerat), 332 + os400: tell about xmllint and xmlcatalog in README400. (Patrick Monnerat), 333 + os400: properly process SGML add in XMLCATALOG command. (Patrick Monnerat), 334 + os400: implement CL command XMLCATALOG. (Patrick Monnerat), 335 + os400: compile and install program xmlcatalog (qshell-only). (Patrick Monnerat), 336 + os400: expand tabs in sources, strip trailing blanks. (Patrick Monnerat), 337 + os400: implement CL command XMLLINT. (Patrick Monnerat), 338 + os400: compile and install program xmllint (qshell-only). (Patrick Monnerat), 339 + os400: initscript make_module(): Use options instead of positional parameters. (Patrick Monnerat), 340 + os400: c14n.rpgle: allow *omit for nullable reference parameters. (Patrick Monnerat), 341 + os400: use like() for double type. (Patrick Monnerat), 342 + os400: use like() for int type. (Patrick Monnerat), 343 + os400: use like() for unsigned int type. (Patrick Monnerat), 344 + os400: use like() for enum types. (Patrick Monnerat), 345 + Add xz to xml2-config --libs output (Baruch Siach), 346 + 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), 347 + win32\VC10\config.h and VS 2015 (Bruce Dawson), 348 + Add configure maintainer mode (orzen) 349 + 350 + - Bug Fixes: 351 + Avoid an out of bound access when serializing malformed strings (Daniel Veillard), 352 + Unsigned addition may overflow in xmlMallocAtomicLoc() (David Kilzer), 353 + Integer signed/unsigned type mismatch in xmlParserInputGrow() (David Kilzer), 354 + Bug 763071: heap-buffer-overflow in xmlStrncat <https://bugzilla.gnome.org/show_bug.cgi?id=763071> (Pranjal Jumde), 355 + Integer overflow parsing port number in URI (Michael Paddon), 356 + Fix an error with regexp on nullable counted char transition (Daniel Veillard), 357 + Fix memory leak with XPath namespace nodes (Nick Wellnhofer), 358 + Fix namespace axis traversal (Nick Wellnhofer), 359 + Fix null pointer deref in docs with no root element (Hugh Davenport), 360 + Fix XSD validation of URIs with ampersands (Alex Henrie), 361 + xmlschemastypes.c: accept endOfDayFrag Times set to "24:00:00" mean "end of day" and should not cause an error. (Patrick Monnerat), 362 + xmlcatalog: flush stdout before interactive shell input. (Patrick Monnerat), 363 + xmllint: flush stdout before interactive shell input. (Patrick Monnerat), 364 + Don't recurse into OP_VALUEs in xmlXPathOptimizeExpression (Nick Wellnhofer), 365 + Fix namespace::node() XPath expression (Nick Wellnhofer), 366 + Fix OOB write in xmlXPathEmptyNodeSet (Nick Wellnhofer), 367 + Fix parsing of NCNames in XPath (Nick Wellnhofer), 368 + Fix OOB read with invalid UTF-8 in xmlUTF8Strsize (Nick Wellnhofer), 369 + Do normalize string-based datatype value in RelaxNG facet checking (Audric Schiltknecht), 370 + 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), 371 + 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), 372 + error.c: *input->cur == 0 does not mean no error (Pavel Raiskup), 373 + Add missing RNG test files (David Kilzer), 374 + 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), 375 + Bug 758572: ASAN crash in make check <https://bugzilla.gnome.org/show_bug.cgi?id=758572> (David Kilzer), 376 + Bug 721158: Missing ICU string when doing --version on xmllint <https://bugzilla.gnome.org/show_bug.cgi?id=721158> (David Kilzer), 377 + python 3: libxml2.c wrappers create Unicode str already (Michael Stahl), 378 + Add autogen.sh to distrib (orzen), 379 + Heap-based buffer overread in xmlNextChar (Daniel Veillard) 380 + 381 + - Improvements: 382 + Add more debugging info to runtest (Daniel Veillard), 383 + Implement "runtest -u" mode (David Kilzer), 384 + Add a make rule to rebuild for ASAN (Daniel Veillard) 385 + 386 + 387 + 388 + v2.9.3: Nov 20 2015: 389 + - Security: 390 + CVE-2015-8242 Buffer overead with HTML parser in push mode (Hugh Davenport), 391 + CVE-2015-7500 Fix memory access error due to incorrect entities boundaries (Daniel Veillard), 392 + CVE-2015-7499-2 Detect incoherency on GROW (Daniel Veillard), 393 + CVE-2015-7499-1 Add xmlHaltParser() to stop the parser (Daniel Veillard), 394 + CVE-2015-5312 Another entity expansion issue (David Drysdale), 395 + CVE-2015-7497 Avoid an heap buffer overflow in xmlDictComputeFastQKey (David Drysdale), 396 + CVE-2015-7498 Avoid processing entities after encoding conversion failures (Daniel Veillard), 397 + CVE-2015-8035 Fix XZ compression support loop (Daniel Veillard), 398 + CVE-2015-7942-2 Fix an error in previous Conditional section patch (Daniel Veillard), 399 + CVE-2015-7942 Another variation of overflow in Conditional sections (Daniel Veillard), 400 + CVE-2015-1819 Enforce the reader to run in constant memory (Daniel Veillard) 401 + CVE-2015-7941_2 Cleanup conditional section error handling (Daniel Veillard), 402 + CVE-2015-7941_1 Stop parsing on entities boundaries errors (Daniel Veillard), 403 + 404 + - Documentation: 405 + Correct spelling of "calling" (Alex Henrie), 406 + Fix a small error in xmllint --format description (Fabien Degomme), 407 + Avoid XSS on the search of xmlsoft.org (Daniel Veillard) 408 + 409 + - Portability: 410 + threads: use forward declarations only for glibc (Michael Heimpold), 411 + Update Win32 configure.js to search for configure.ac (Daniel Veillard) 412 + 413 + - Bug Fixes: 414 + Bug on creating new stream from entity (Daniel Veillard), 415 + Fix some loop issues embedding NEXT (Daniel Veillard), 416 + Do not print error context when there is none (Daniel Veillard), 417 + Avoid extra processing of MarkupDecl when EOF (Hugh Davenport), 418 + Fix parsing short unclosed comment uninitialized access (Daniel Veillard), 419 + Add missing Null check in xmlParseExternalEntityPrivate (Gaurav Gupta), 420 + Fix a bug in CData error handling in the push parser (Daniel Veillard), 421 + Fix a bug on name parsing at the end of current input buffer (Daniel Veillard), 422 + Fix the spurious ID already defined error (Daniel Veillard), 423 + Fix previous change to node sort order (Nick Wellnhofer), 424 + Fix a self assignment issue raised by clang (Scott Graham), 425 + Fail parsing early on if encoding conversion failed (Daniel Veillard), 426 + Do not process encoding values if the declaration if broken (Daniel Veillard), 427 + Silence clang's -Wunknown-attribute (Michael Catanzaro), 428 + xmlMemUsed is not thread-safe (Martin von Gagern), 429 + Fix support for except in nameclasses (Daniel Veillard), 430 + Fix order of root nodes (Nick Wellnhofer), 431 + Allow attributes on descendant-or-self axis (Nick Wellnhofer), 432 + Fix the fix to Windows locking (Steve Nairn), 433 + Fix timsort invariant loop re: Envisage article (Christopher Swenson), 434 + Don't add IDs in xmlSetTreeDoc (Nick Wellnhofer), 435 + Account for ID attributes in xmlSetTreeDoc (Nick Wellnhofer), 436 + Remove various unused value assignments (Philip Withnall), 437 + Fix missing entities after CVE-2014-3660 fix (Daniel Veillard), 438 + Revert "Missing initialization for the catalog module" (Daniel Veillard) 439 + 440 + - Improvements: 441 + Reuse xmlHaltParser() where it makes sense (Daniel Veillard), 442 + xmlStopParser reset errNo (Daniel Veillard), 443 + Reenable xz support by default (Daniel Veillard), 444 + Recover unescaped less-than character in HTML recovery parsing (Daniel Veillard), 445 + Allow HTML serializer to output HTML5 DOCTYPE (Shaun McCance), 446 + Regression test for bug #695699 (Nick Wellnhofer), 447 + Add a couple of XPath tests (Nick Wellnhofer), 448 + Add Python 3 rpm subpackage (Tomas Radej), 449 + libxml2-config.cmake.in: update include directories (Samuel Martin), 450 + Adding example from bugs 738805 to regression tests (Daniel Veillard) 451 + 452 + - Cleanups: 453 + 454 + 455 + 13 456 2.9.2: Oct 16 2014: 14 457 - Security: 15 458 Fix for CVE-2014-3660 billion laugh variant (Daniel Veillard), ··· 845 1288 - Improvement: switch parser to XML-1.0 5th edition, add parsing flags 846 1289 for old versions, switch URI parsing to RFC 3986, 847 1290 add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer), 848 - new hashing functions for dictionaries (based on Stefan Behnel work), 1291 + new hashing functions for dictionnaries (based on Stefan Behnel work), 849 1292 improve handling of misplaced html/head/body in HTML parser, better 850 1293 regression test tools and code coverage display, better algorithms 851 1294 to detect various versions of the billion laughts attacks, make ··· 955 1398 on Windows (Igor Zlatkovic), htmlCtxtReset fix (Michael Day), XPath 956 1399 principal node of axis bug, HTML serialization of some codepoint 957 1400 (Steven Rainwater), user data propagation in XInclude (Michael Day), 958 - standalone and XML decl detection (Michael Day), Python id ouptut 1401 + standalone and XML decl detection (Michael Day), Python id output 959 1402 for some id, fix the big python string memory leak, URI parsing fixes 960 1403 (Stéphane Bidoul and William), long comments parsing bug (William), 961 1404 concurrent threads initialization (Ted Phelps), invalid char ··· 967 1410 min occurs of 0 (William), HTML script/style parsing (Mike Day) 968 1411 - Improvement: make xmlTextReaderSetup() public 969 1412 - Compilation and postability: fix a missing include problem (William), 970 - __ss_familly on AIX again (Björn Wiberg), compilation without zlib 1413 + __ss_family on AIX again (Björn Wiberg), compilation without zlib 971 1414 (Michael Day), catalog patch for Win32 (Christian Ehrlicher), 972 1415 Windows CE fixes (Andreas Stricke) 973 1416 - Various CVS to SVN infrastructure changes ··· 1006 1449 fix attribute serialization in writer (Rob Richards), PHP4 DTD validation 1007 1450 crasher, parser safety patch (Ben Darnell), _private context propagation 1008 1451 when parsing entities (with Michael Day), fix entities behaviour when 1009 - using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity 1452 + using SAX, URI to file path fix (Mikhail Zabaluev), disappearing validity 1010 1453 context, arg error in SAX callback (Mike Hommey), fix mixed-content 1011 1454 autodetect when using --noblanks, fix xmlIOParseDTD error handling, 1012 1455 fix bug in xmlSplitQName on special Names, fix Relax-NG element content ··· 1090 1533 split problem (William), issues with non-namespaced attributes in 1091 1534 xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), 1092 1535 HTML parsing of script, Python must not output to stdout (Nic Ferrier), 1093 - exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype 1536 + exclusive C14N namespace visibility (Aleksey Sanin), XSD datatype 1094 1537 totalDigits bug (Kasimier Buchcik), error handling when writing to an 1095 1538 xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi 1096 1539 Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix ··· 1099 1542 (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of 1100 1543 runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs 1101 1544 (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), 1102 - compilation and build fixes (Michael Day), removed dependancies on 1545 + compilation and build fixes (Michael Day), removed dependencies on 1103 1546 xmlSchemaValidError (Kasimier), bug with <xml:foo/>, more XPath 1104 1547 pattern based evaluation fixes (Kasimier) 1105 1548 - improvements: XSD Schemas redefinitions/restrictions (Kasimier ··· 1144 1587 foreign namespaces handling, XML Schemas facet comparison (Kupriyanov 1145 1588 Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: 1146 1589 namespace ahndling in Schemas (Kasimier), empty model group in Schemas 1147 - (Kasimier), wilcard in Schemas (Kasimier), URI composition (William), 1590 + (Kasimier), wildcard in Schemas (Kasimier), URI composition (William), 1148 1591 xs:anyType in Schemas (Kasimier), Python resolver emmitting error 1149 1592 messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to 1150 1593 fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob ··· 1231 1674 Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), 1232 1675 some gcc4 fixes, HP-UX portability fixes (Rick Jones). 1233 1676 - bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and 1234 - xmlreader stopping on non-fatal errors, thread support for dictionaries 1677 + xmlreader stopping on non-fatal errors, thread support for dictionnaries 1235 1678 reference counting (Gary Coady), internal subset and push problem, URL 1236 1679 saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths 1237 1680 fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix ··· 1318 1761 Buchcik), XInclude testing, Notation serialization, UTF8ToISO8859x 1319 1762 transcoding (Mark Itzcovitz), lots of XML Schemas cleanup and fixes 1320 1763 (Kasimier), ChangeLog cleanup (Stepan Kasal), memory fixes (Mark Vakoc), 1321 - handling of failed realloc(), out of bound array adressing in Schemas 1764 + handling of failed realloc(), out of bound array addressing in Schemas 1322 1765 date handling, Python space/tabs cleanups (Malcolm Tredinnick), NMTOKENS 1323 1766 E20 validation fix (Malcolm), 1324 1767 - improvements: added W3C XML Schemas testsuite (Kasimier Buchcik), add ··· 1335 1778 (Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack 1336 1779 and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace 1337 1780 problem (William), Schemas hexbinary empty values, encoding error could 1338 - genrate a serialization loop. 1781 + generate a serialization loop. 1339 1782 - Improvements: Schemas validity improvements (Kasimier), added --path 1340 1783 and --load-trace options to xmllint 1341 1784 - documentation: tutorial update (John Fleck) ··· 1482 1925 William) reported by Yuuichi Teranishi 1483 1926 - bugfixes: make test and path issues, xmlWriter attribute serialization 1484 1927 (William Brack), xmlWriter indentation (William), schemas validation 1485 - (Eric Haszlakiewicz), XInclude dictionaries issues (William and Oleg 1928 + (Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg 1486 1929 Paraschenko), XInclude empty fallback (William), HTML warnings (William), 1487 1930 XPointer in XInclude (William), Python namespace serialization, 1488 1931 isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter ··· 1493 1936 --with-minimum configuration. 1494 1937 - XInclude: allow the 2001 namespace without warning. 1495 1938 - Documentation: missing example/index.html (John Fleck), version 1496 - dependancies (John Fleck) 1939 + dependencies (John Fleck) 1497 1940 - reader API: structured error reporting (Steve Ball) 1498 1941 - Windows compilation: mingw, msys (Mikhail Grushinskiy), function 1499 1942 prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_ ··· 1503 1946 1504 1947 1505 1948 2.6.5: Jan 25 2004: 1506 - - Bugfixes: dictionaries for schemas (William Brack), regexp segfault 1949 + - Bugfixes: dictionnaries for schemas (William Brack), regexp segfault 1507 1950 (William), xs:all problem (William), a number of XPointer bugfixes 1508 1951 (William), xmllint error go to stderr, DTD validation problem with 1509 1952 namespace, memory leak (William), SAX1 cleanup and minimal options fixes ··· 1627 2070 intercepted at a structured level, with precise information 1628 2071 available. 1629 2072 - New simpler and more generic XML and HTML parser APIs, allowing to 1630 - easilly modify the parsing options and reuse parser context for multiple 2073 + easily modify the parsing options and reuse parser context for multiple 1631 2074 consecutive documents. 1632 2075 - Similar new APIs for the xmlReader, for options and reuse, provided new 1633 2076 functions to access content as const strings, use them for Python
+1
sdk/lib/3rdparty/libxml2/README
··· 8 8 9 9 To build on an Unixised setup: 10 10 ./configure ; make ; make install 11 + if the ./configure file does not exist, run ./autogen.sh instead. 11 12 To build on Windows: 12 13 see instructions on win32/Readme.txt 13 14
+12 -10
sdk/lib/3rdparty/libxml2/SAX2.c
··· 40 40 * TODO: 41 41 * 42 42 * macro to flag unimplemented blocks 43 - * XML_CATALOG_PREFER user env to select between system/public prefered 43 + * XML_CATALOG_PREFER user env to select between system/public preferred 44 44 * option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk> 45 45 *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with 46 46 *> values "system" and "public". I have made the default be "system" to ··· 1512 1512 attr = elemDecl->attributes; 1513 1513 while (attr != NULL) { 1514 1514 /* 1515 - * Make sure that attributes redefinition occuring in the 1516 - * internal subset are not overriden by definitions in the 1515 + * Make sure that attributes redefinition occurring in the 1516 + * internal subset are not overridden by definitions in the 1517 1517 * external subset. 1518 1518 */ 1519 1519 if (attr->defaultValue != NULL) { ··· 1668 1668 if (nodePush(ctxt, ret) < 0) { 1669 1669 xmlUnlinkNode(ret); 1670 1670 xmlFreeNode(ret); 1671 + if (prefix != NULL) 1672 + xmlFree(prefix); 1671 1673 return; 1672 1674 } 1673 1675 ··· 1734 1736 } 1735 1737 1736 1738 /* 1737 - * set the namespace node, making sure that if the default namspace 1738 - * is unbound on a parent we simply kee it NULL 1739 + * set the namespace node, making sure that if the default namespace 1740 + * is unbound on a parent we simply keep it NULL 1739 1741 */ 1740 1742 if ((ns != NULL) && (ns->href != NULL) && 1741 1743 ((ns->href[0] != 0) || (ns->prefix != NULL))) ··· 2010 2012 else 2011 2013 ret->name = xmlStrdup(localname); 2012 2014 2013 - /* link at the end to preserv order, TODO speed up with a last */ 2015 + /* link at the end to preserve order, TODO speed up with a last */ 2014 2016 if (ctxt->node->properties == NULL) { 2015 2017 ctxt->node->properties = ret; 2016 2018 } else { ··· 2102 2104 } else { 2103 2105 /* 2104 2106 * dup now contains a string of the flattened attribute 2105 - * content with entities substitued. Check if we need to 2107 + * content with entities substituted. Check if we need to 2106 2108 * apply an extra layer of normalization. 2107 2109 * It need to be done twice ... it's an extra burden related 2108 2110 * to the ability to keep references in attributes ··· 2135 2137 } 2136 2138 } else { 2137 2139 /* 2138 - * if entities already have been substitued, then 2140 + * if entities already have been substituted, then 2139 2141 * the attribute as passed is already normalized 2140 2142 */ 2141 2143 dup = xmlStrndup(value, valueend - value); ··· 2398 2400 if (nb_attributes > 0) { 2399 2401 for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { 2400 2402 /* 2401 - * Handle the rare case of an undefined atribute prefix 2403 + * Handle the rare case of an undefined attribute prefix 2402 2404 */ 2403 2405 if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { 2404 2406 if (ctxt->dictNames) { ··· 2584 2586 * The whole point of maintaining nodelen and nodemem, 2585 2587 * xmlTextConcat is too costly, i.e. compute length, 2586 2588 * reallocate a new buffer, move data, append ch. Here 2587 - * We try to minimaze realloc() uses and avoid copying 2589 + * We try to minimize realloc() uses and avoid copying 2588 2590 * and recomputing length over and over. 2589 2591 */ 2590 2592 if (lastChild->content == (xmlChar *)&(lastChild->properties)) {
+6 -6
sdk/lib/3rdparty/libxml2/buf.c
··· 1 1 /* 2 2 * buf.c: memory buffers for libxml2 3 3 * 4 - * new buffer structures and entry points to simplify the maintainance 4 + * new buffer structures and entry points to simplify the maintenance 5 5 * of libxml2 and ensure we keep good control over memory allocations 6 6 * and stay 64 bits clean. 7 7 * The new entry point use the xmlBufPtr opaque structure and ··· 396 396 ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) { 397 397 /* 398 398 * we just move the content pointer, but also make sure 399 - * the perceived buffer size has shrinked accordingly 399 + * the perceived buffer size has shrunk accordingly 400 400 */ 401 401 buf->content += len; 402 402 buf->size -= len; ··· 958 958 959 959 if (start_buf > (unsigned int) len) { 960 960 /* 961 - * We can add it in the space previously shrinked 961 + * We can add it in the space previously shrunk 962 962 */ 963 963 buf->content -= len; 964 964 memmove(&buf->content[0], str, len); ··· 1204 1204 xmlBufBackToBuffer(xmlBufPtr buf) { 1205 1205 xmlBufferPtr ret; 1206 1206 1207 - if ((buf == NULL) || (buf->error)) 1207 + if (buf == NULL) 1208 1208 return(NULL); 1209 1209 CHECK_COMPAT(buf) 1210 - if (buf->buffer == NULL) { 1210 + if ((buf->error) || (buf->buffer == NULL)) { 1211 1211 xmlBufFree(buf); 1212 1212 return(NULL); 1213 1213 } ··· 1307 1307 CHECK_COMPAT(buf) 1308 1308 base = input->base - buf->content; 1309 1309 /* 1310 - * We could do some pointer arythmetic checks but that's probably 1310 + * We could do some pointer arithmetic checks but that's probably 1311 1311 * sufficient. 1312 1312 */ 1313 1313 if (base > buf->size) {
+6 -6
sdk/lib/3rdparty/libxml2/c14n.c
··· 43 43 44 44 typedef struct _xmlC14NVisibleNsStack { 45 45 int nsCurEnd; /* number of nodes in the set */ 46 - int nsPrevStart; /* the begginning of the stack for previous visible node */ 46 + int nsPrevStart; /* the beginning of the stack for previous visible node */ 47 47 int nsPrevEnd; /* the end of the stack for previous visible node */ 48 48 int nsMax; /* size of the array as allocated */ 49 49 xmlNsPtr *nsTab; /* array of ns in no particular order */ ··· 226 226 * xmlC14NErr: 227 227 * @ctxt: a C14N evaluation context 228 228 * @node: the context node 229 - * @error: the erorr code 229 + * @error: the error code 230 230 * @msg: the message 231 231 * @extra: extra informations 232 232 * ··· 1827 1827 } 1828 1828 1829 1829 /* 1830 - * Set "mode" flag and remember list of incluseve prefixes 1830 + * Set "mode" flag and remember list of inclusive prefixes 1831 1831 * for exclusive c14n 1832 1832 */ 1833 1833 ctx->mode = mode; ··· 2039 2039 (void) xmlOutputBufferClose(buf); 2040 2040 2041 2041 if ((*doc_txt_ptr == NULL) && (ret > 0)) { 2042 - xmlC14NErrMemory("coping canonicanized document"); 2042 + xmlC14NErrMemory("coping canonicalized document"); 2043 2043 return (-1); 2044 2044 } 2045 2045 return (ret); ··· 2057 2057 * canonicalization, ignored otherwise) 2058 2058 * @with_comments: include comments in the result (!=0) or not (==0) 2059 2059 * @filename: the filename to store canonical XML image 2060 - * @compression: the compression level (zlib requred): 2060 + * @compression: the compression level (zlib required): 2061 2061 * -1 - libxml default, 2062 2062 * 0 - uncompressed, 2063 2063 * >0 - compression level ··· 2100 2100 ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, 2101 2101 with_comments, buf); 2102 2102 if (ret < 0) { 2103 - xmlC14NErrInternal("cannicanize document to buffer"); 2103 + xmlC14NErrInternal("canonize document to buffer"); 2104 2104 (void) xmlOutputBufferClose(buf); 2105 2105 return (-1); 2106 2106 }
+1 -1
sdk/lib/3rdparty/libxml2/catalog.c
··· 56 56 * TODO: 57 57 * 58 58 * macro to flag unimplemented blocks 59 - * XML_CATALOG_PREFER user env to select between system/public prefered 59 + * XML_CATALOG_PREFER user env to select between system/public preferred 60 60 * option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk> 61 61 *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with 62 62 *> values "system" and "public". I have made the default be "system" to
+8 -14
sdk/lib/3rdparty/libxml2/debugXML.c
··· 289 289 dict = doc->dict; 290 290 if ((dict == NULL) && (ctxt->nodict == 0)) { 291 291 #if 0 292 - /* desactivated right now as it raises too many errors */ 292 + /* deactivated right now as it raises too many errors */ 293 293 if (doc->type == XML_DOCUMENT_NODE) 294 294 xmlDebugErr(ctxt, XML_CHECK_NO_DICT, 295 295 "Document has no dictionary\n"); ··· 1168 1168 * @output: the FILE * for the output 1169 1169 * @doc: the document 1170 1170 * 1171 - * Dumps debug information cncerning the document, not recursive 1171 + * Dumps debug information concerning the document, not recursive 1172 1172 */ 1173 1173 static void 1174 1174 xmlCtxtDumpDocumentHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) ··· 1498 1498 * @output: the FILE * for the output 1499 1499 * @doc: the document 1500 1500 * 1501 - * Dumps debug information cncerning the document, not recursive 1501 + * Dumps debug information concerning the document, not recursive 1502 1502 */ 1503 1503 void 1504 1504 xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc) ··· 2363 2363 int ret; 2364 2364 2365 2365 ctxt = xmlRelaxNGNewParserCtxt(schemas); 2366 - xmlRelaxNGSetParserErrors(ctxt, 2367 - (xmlRelaxNGValidityErrorFunc) fprintf, 2368 - (xmlRelaxNGValidityWarningFunc) fprintf, 2369 - stderr); 2366 + xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL); 2370 2367 relaxngschemas = xmlRelaxNGParse(ctxt); 2371 2368 xmlRelaxNGFreeParserCtxt(ctxt); 2372 2369 if (relaxngschemas == NULL) { ··· 2375 2372 return(-1); 2376 2373 } 2377 2374 vctxt = xmlRelaxNGNewValidCtxt(relaxngschemas); 2378 - xmlRelaxNGSetValidErrors(vctxt, 2379 - (xmlRelaxNGValidityErrorFunc) fprintf, 2380 - (xmlRelaxNGValidityWarningFunc) fprintf, 2381 - stderr); 2375 + xmlRelaxNGSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL); 2382 2376 ret = xmlRelaxNGValidateDoc(vctxt, sctxt->doc); 2383 2377 if (ret == 0) { 2384 2378 fprintf(stderr, "%s validates\n", sctxt->filename); ··· 2647 2641 int res = -1; 2648 2642 2649 2643 if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1); 2650 - vctxt.userData = stderr; 2651 - vctxt.error = (xmlValidityErrorFunc) fprintf; 2652 - vctxt.warning = (xmlValidityWarningFunc) fprintf; 2644 + vctxt.userData = NULL; 2645 + vctxt.error = xmlGenericError; 2646 + vctxt.warning = xmlGenericError; 2653 2647 2654 2648 if ((dtd == NULL) || (dtd[0] == 0)) { 2655 2649 res = xmlValidateDocument(&vctxt, ctxt->doc);
+10 -3
sdk/lib/3rdparty/libxml2/dict.c
··· 38 38 * list we will use the BigKey algo as soon as the hash size grows 39 39 * over MIN_DICT_SIZE so this actually works 40 40 */ 41 - #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) 41 + #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \ 42 + !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) 42 43 #define DICT_RANDOMIZATION 43 44 #endif 44 45 ··· 371 372 * http://burtleburtle.net/bob/hash/doobs.html 372 373 */ 373 374 375 + #ifdef __clang__ 376 + ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow") 377 + #endif 374 378 static uint32_t 375 379 xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) { 376 380 uint32_t hash; ··· 403 407 * 404 408 * Neither of the two strings must be NULL. 405 409 */ 410 + #ifdef __clang__ 411 + ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow") 412 + #endif 406 413 static unsigned long 407 414 xmlDictComputeBigQKey(const xmlChar *prefix, int plen, 408 415 const xmlChar *name, int len, int seed) ··· 727 734 dict->dict[key].next = entry; 728 735 } else { 729 736 /* 730 - * we don't have much ways to alert from herei 737 + * we don't have much ways to alert from here 731 738 * result is losing an entry and unicity guarantee 732 739 */ 733 740 ret = -1; ··· 1202 1209 * @dict: the dictionary 1203 1210 * @str: the string 1204 1211 * 1205 - * check if a string is owned by the disctionary 1212 + * check if a string is owned by the dictionary 1206 1213 * 1207 1214 * Returns 1 if true, 0 if false and -1 in case of error 1208 1215 * -1 in case of error
+10
sdk/lib/3rdparty/libxml2/elfgcchack.h
··· 4312 4312 #endif 4313 4313 4314 4314 #ifdef bottom_hash 4315 + #undef xmlHashDefaultDeallocator 4316 + extern __typeof (xmlHashDefaultDeallocator) xmlHashDefaultDeallocator __attribute((alias("xmlHashDefaultDeallocator__internal_alias"))); 4317 + #else 4318 + #ifndef xmlHashDefaultDeallocator 4319 + extern __typeof (xmlHashDefaultDeallocator) xmlHashDefaultDeallocator__internal_alias __attribute((visibility("hidden"))); 4320 + #define xmlHashDefaultDeallocator xmlHashDefaultDeallocator__internal_alias 4321 + #endif 4322 + #endif 4323 + 4324 + #ifdef bottom_hash 4315 4325 #undef xmlHashFree 4316 4326 extern __typeof (xmlHashFree) xmlHashFree __attribute((alias("xmlHashFree__internal_alias"))); 4317 4327 #else
+1 -1
sdk/lib/3rdparty/libxml2/enc.h
··· 1 1 /* 2 2 * Summary: Internal Interfaces for encoding in libxml2 3 3 * Description: this module describes a few interfaces which were 4 - * addded along with the API changes in 2.9.0 4 + * added along with the API changes in 2.9.0 5 5 * those are private routines at this point 6 6 * 7 7 * Copy: See Copyright for the status of this software.
+9 -9
sdk/lib/3rdparty/libxml2/encoding.c
··· 1795 1795 * 1796 1796 * The value of @inlen after return is the number of octets consumed 1797 1797 * as the return value is positive, else unpredictable. 1798 - * The value of @outlen after return is the number of ocetes consumed. 1798 + * The value of @outlen after return is the number of octets consumed. 1799 1799 */ 1800 1800 static int 1801 1801 xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, ··· 1863 1863 * 1864 1864 * The value of @inlen after return is the number of octets consumed 1865 1865 * as the return value is positive, else unpredictable. 1866 - * The value of @outlen after return is the number of ocetes consumed. 1866 + * The value of @outlen after return is the number of octets consumed. 1867 1867 */ 1868 1868 static int 1869 1869 xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, ··· 1972 1972 1973 1973 /** 1974 1974 * xmlCharEncFirstLineInt: 1975 - * @handler: char enconding transformation data structure 1975 + * @handler: char encoding transformation data structure 1976 1976 * @out: an xmlBuffer for the output. 1977 1977 * @in: an xmlBuffer for the input 1978 1978 * @len: number of bytes to convert for the first line, or -1 ··· 2059 2059 2060 2060 /** 2061 2061 * xmlCharEncFirstLine: 2062 - * @handler: char enconding transformation data structure 2062 + * @handler: char encoding transformation data structure 2063 2063 * @out: an xmlBuffer for the output. 2064 2064 * @in: an xmlBuffer for the input 2065 2065 * ··· 2546 2546 2547 2547 /** 2548 2548 * xmlCharEncOutFunc: 2549 - * @handler: char enconding transformation data structure 2549 + * @handler: char encoding transformation data structure 2550 2550 * @out: an xmlBuffer for the output. 2551 2551 * @in: an xmlBuffer for the input 2552 2552 * ··· 2710 2710 2711 2711 /** 2712 2712 * xmlCharEncCloseFunc: 2713 - * @handler: char enconding transformation data structure 2713 + * @handler: char encoding transformation data structure 2714 2714 * 2715 2715 * Generic front-end for encoding handler close function 2716 2716 * ··· 2811 2811 xmlCharEncodingHandler * handler = in->buf->encoder; 2812 2812 /* 2813 2813 * Encoding conversion, compute the number of unused original 2814 - * bytes from the input not consumed and substract that from 2814 + * bytes from the input not consumed and subtract that from 2815 2815 * the raw consumed value, this is not a cheap operation 2816 2816 */ 2817 2817 if (in->end - in->cur > 0) { ··· 2860 2860 * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise 2861 2861 * The value of @inlen after return is the number of octets consumed 2862 2862 * as the return value is positive, else unpredictable. 2863 - * The value of @outlen after return is the number of ocetes consumed. 2863 + * The value of @outlen after return is the number of octets consumed. 2864 2864 */ 2865 2865 static int 2866 2866 UTF8ToISO8859x(unsigned char* out, int *outlen, ··· 2976 2976 * block of chars out. 2977 2977 * Returns 0 if success, or -1 otherwise 2978 2978 * The value of @inlen after return is the number of octets consumed 2979 - * The value of @outlen after return is the number of ocetes produced. 2979 + * The value of @outlen after return is the number of octets produced. 2980 2980 */ 2981 2981 static int 2982 2982 ISO8859xToUTF8(unsigned char* out, int *outlen,
+3 -3
sdk/lib/3rdparty/libxml2/entities.c
··· 148 148 /* 149 149 * xmlCreateEntity: 150 150 * 151 - * internal routine doing the entity node strutures allocations 151 + * internal routine doing the entity node structures allocations 152 152 */ 153 153 static xmlEntityPtr 154 154 xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type, ··· 398 398 * 399 399 * Create a new entity, this differs from xmlAddDocEntity() that if 400 400 * the document is NULL or has no internal subset defined, then an 401 - * unlinked entity structure will be returned, it is then the responsability 401 + * unlinked entity structure will be returned, it is then the responsibility 402 402 * of the caller to link it to the document later or free it when not needed 403 403 * anymore. 404 404 * ··· 548 548 * xmlEncodeEntitiesInternal: 549 549 * @doc: the document containing the string 550 550 * @input: A string to convert to XML. 551 - * @attr: are we handling an atrbute value 551 + * @attr: are we handling an attribute value 552 552 * 553 553 * Do a global encoding of a string, replacing the predefined entities 554 554 * and non ASCII values with their entities and CharRef counterparts.
+2 -2
sdk/lib/3rdparty/libxml2/error.c
··· 238 238 * @ctx: the parser context or NULL 239 239 * @str: the formatted error message 240 240 * 241 - * Report an erro with its context, replace the 4 old error/warning 241 + * Report an error with its context, replace the 4 old error/warning 242 242 * routines. 243 243 */ 244 244 static void ··· 631 631 (channel == xmlParserValidityError) || 632 632 (channel == xmlParserValidityWarning)) 633 633 xmlReportError(to, ctxt, str, NULL, NULL); 634 - else if ((channel == (xmlGenericErrorFunc) fprintf) || 634 + else if (((void(*)(void)) channel == (void(*)(void)) fprintf) || 635 635 (channel == xmlGenericErrorDefaultFunc)) 636 636 xmlReportError(to, ctxt, str, channel, data); 637 637 else
+3 -3
sdk/lib/3rdparty/libxml2/globals.c
··· 107 107 * @size: the size requested in bytes 108 108 * 109 109 * The variable holding the libxml malloc() implementation for atomic 110 - * data (i.e. blocks not containings pointers), useful when using a 110 + * data (i.e. blocks not containing pointers), useful when using a 111 111 * garbage collecting allocator. 112 112 * 113 113 * Returns a pointer to the newly allocated block or NULL in case of error ··· 260 260 * Global setting, indicate that the parser should store the line number 261 261 * in the content field of elements in the DOM tree. 262 262 * Disabled by default since this may not be safe for old classes of 263 - * applicaton. 263 + * application. 264 264 */ 265 265 int xmlLineNumbersDefaultValue = 0; 266 266 static int xmlLineNumbersDefaultValueThrDef = 0; ··· 361 361 * xmlSaveNoEmptyTags: 362 362 * 363 363 * Global setting, asking the serializer to not output empty tags 364 - * as <empty/> but <empty></empty>. those two forms are undistinguishable 364 + * as <empty/> but <empty></empty>. those two forms are indistinguishable 365 365 * once parsed. 366 366 * Disabled by default 367 367 */
+8 -1
sdk/lib/3rdparty/libxml2/hash.c
··· 33 33 * it seems that having hash randomization might be a good idea 34 34 * when using XML with untrusted data 35 35 */ 36 - #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) 36 + #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \ 37 + !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) 37 38 #define HASH_RANDOMIZATION 38 39 #endif 39 40 ··· 78 79 * xmlHashComputeKey: 79 80 * Calculate the hash key 80 81 */ 82 + #ifdef __clang__ 83 + ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow") 84 + #endif 81 85 static unsigned long 82 86 xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, 83 87 const xmlChar *name2, const xmlChar *name3) { ··· 108 112 return (value % table->size); 109 113 } 110 114 115 + #ifdef __clang__ 116 + ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow") 117 + #endif 111 118 static unsigned long 112 119 xmlHashComputeQKey(xmlHashTablePtr table, 113 120 const xmlChar *prefix, const xmlChar *name,
+1 -1
sdk/lib/3rdparty/libxml2/include/win32config.h
··· 38 38 #if defined(_MSC_VER) || defined(__BORLANDC__) 39 39 /* MS C-runtime has functions which can be used in order to determine if 40 40 a given floating-point variable contains NaN, (+-)INF. These are 41 - preferred, because floating-point technology is considered propriatary 41 + preferred, because floating-point technology is considered proprietary 42 42 by MS and we can assume that their functions know more about their 43 43 oddities than we do. */ 44 44 #include <float.h>
+5
sdk/lib/3rdparty/libxml2/include/wsockcompat.h
··· 11 11 #include <errno.h> 12 12 #include <winsock2.h> 13 13 14 + /* Fix for old MinGW. */ 15 + #ifndef _WINSOCKAPI_ 16 + #define _WINSOCKAPI_ 17 + #endif 18 + 14 19 /* the following is a workaround a problem for 'inline' keyword in said 15 20 header when compiled with Borland C++ 6 */ 16 21 #if defined(__BORLANDC__) && !defined(__cplusplus)
+10 -3
sdk/lib/3rdparty/libxml2/libxml.h
··· 34 34 /* 35 35 * Currently supported platforms use either autoconf or 36 36 * copy to config.h own "preset" configuration file. 37 - * As result ifdef HAVE_CONFIG_H is omited here. 37 + * As result ifdef HAVE_CONFIG_H is omitted here. 38 38 */ 39 39 #include "config.h" 40 40 #include <libxml/xmlversion.h> ··· 53 53 /** 54 54 * TRIO_REPLACE_STDIO: 55 55 * 56 - * This macro is defined if teh trio string formatting functions are to 56 + * This macro is defined if the trio string formatting functions are to 57 57 * be used instead of the default stdio ones. 58 58 */ 59 59 #define TRIO_REPLACE_STDIO ··· 72 72 #define XML_POP_WARNINGS 73 73 #endif 74 74 75 + #if defined(__clang__) || \ 76 + (defined(__GNUC__) && (__GNUC__ >= 8)) 77 + #define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg))) 78 + #else 79 + #define ATTRIBUTE_NO_SANITIZE(arg) 80 + #endif 81 + 75 82 /* 76 83 * Internal variable indicating if a callback has been registered for 77 84 * node creation/destruction. It avoids spending a lot of time in locking ··· 79 86 */ 80 87 extern int __xmlRegisterCallbacks; 81 88 /* 82 - * internal error reporting routines, shared but not partof the API. 89 + * internal error reporting routines, shared but not part of the API. 83 90 */ 84 91 void __xmlIOErr(int domain, int code, const char *extra); 85 92 void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0);
+2 -2
sdk/lib/3rdparty/libxml2/nanohttp.c
··· 1143 1143 1144 1144 switch (h_errno) { 1145 1145 case HOST_NOT_FOUND: 1146 - h_err_txt = "Authoritive host not found"; 1146 + h_err_txt = "Authoritative host not found"; 1147 1147 break; 1148 1148 1149 1149 case TRY_AGAIN: 1150 1150 h_err_txt = 1151 - "Non-authoritive host not found or server failure."; 1151 + "Non-authoritative host not found or server failure."; 1152 1152 break; 1153 1153 1154 1154 case NO_RECOVERY:
+298 -274
sdk/lib/3rdparty/libxml2/parser.c
··· 96 96 97 97 static void xmlHaltParser(xmlParserCtxtPtr ctxt); 98 98 99 + static int 100 + xmlParseElementStart(xmlParserCtxtPtr ctxt); 101 + 102 + static void 103 + xmlParseElementEnd(xmlParserCtxtPtr ctxt); 104 + 99 105 /************************************************************************ 100 106 * * 101 107 * Arbitrary limits set in the parser. See XML_PARSE_HUGE * ··· 108 114 /* 109 115 * XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity 110 116 * replacement over the size in byte of the input indicates that you have 111 - * and eponential behaviour. A value of 10 correspond to at least 3 entity 117 + * and exponential behaviour. A value of 10 correspond to at least 3 entity 112 118 * replacement per byte of input. 113 119 */ 114 120 #define XML_PARSER_NON_LINEAR 10 ··· 140 146 if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && 141 147 (ent->content != NULL) && (ent->checked == 0) && 142 148 (ctxt->errNo != XML_ERR_ENTITY_LOOP)) { 143 - unsigned long oldnbent = ctxt->nbentities; 149 + unsigned long oldnbent = ctxt->nbentities, diff; 144 150 xmlChar *rep; 145 151 146 152 ent->checked = 1; ··· 153 159 ent->content[0] = 0; 154 160 } 155 161 156 - ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; 162 + diff = ctxt->nbentities - oldnbent + 1; 163 + if (diff > INT_MAX / 2) 164 + diff = INT_MAX / 2; 165 + ent->checked = diff * 2; 157 166 if (rep != NULL) { 158 167 if (xmlStrchr(rep, '<')) 159 168 ent->checked |= 1; ··· 1060 1069 * xmlDetectSAX2: 1061 1070 * @ctxt: an XML parser context 1062 1071 * 1063 - * Do the SAX2 detection and specific intialization 1072 + * Do the SAX2 detection and specific initialization 1064 1073 */ 1065 1074 static void 1066 1075 xmlDetectSAX2(xmlParserCtxtPtr ctxt) { ··· 1392 1401 * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ 1393 1402 * [38] Subcode ::= ([a-z] | [A-Z])+ 1394 1403 * 1395 - * The current REC reference the sucessors of RFC 1766, currently 5646 1404 + * The current REC reference the successors of RFC 1766, currently 5646 1396 1405 * 1397 1406 * http://www.rfc-editor.org/rfc/rfc5646.txt 1398 1407 * langtag = language ··· 1819 1828 return (ret); 1820 1829 } 1821 1830 1822 - #ifdef LIBXML_PUSH_ENABLED 1823 1831 /** 1824 1832 * nameNsPush: 1825 1833 * @ctxt: an XML parser context ··· 1855 1863 goto mem_error; 1856 1864 } 1857 1865 ctxt->pushTab = tmp2; 1866 + } else if (ctxt->pushTab == NULL) { 1867 + ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 * 1868 + sizeof(ctxt->pushTab[0])); 1869 + if (ctxt->pushTab == NULL) 1870 + goto mem_error; 1858 1871 } 1859 1872 ctxt->nameTab[ctxt->nameNr] = value; 1860 1873 ctxt->name = value; ··· 1866 1879 xmlErrMemory(ctxt, NULL); 1867 1880 return (-1); 1868 1881 } 1882 + #ifdef LIBXML_PUSH_ENABLED 1869 1883 /** 1870 1884 * nameNsPop: 1871 1885 * @ctxt: an XML parser context ··· 2075 2089 xmlGROW (ctxt); 2076 2090 2077 2091 static void xmlGROW (xmlParserCtxtPtr ctxt) { 2078 - unsigned long curEnd = ctxt->input->end - ctxt->input->cur; 2079 - unsigned long curBase = ctxt->input->cur - ctxt->input->base; 2092 + ptrdiff_t curEnd = ctxt->input->end - ctxt->input->cur; 2093 + ptrdiff_t curBase = ctxt->input->cur - ctxt->input->base; 2080 2094 2081 - if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) || 2082 - (curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) && 2095 + if (((curEnd > XML_MAX_LOOKUP_LIMIT) || 2096 + (curBase > XML_MAX_LOOKUP_LIMIT)) && 2083 2097 ((ctxt->input->buf) && 2084 2098 (ctxt->input->buf->readcallback != xmlInputReadCallbackNop)) && 2085 2099 ((ctxt->options & XML_PARSE_HUGE) == 0)) { ··· 2281 2295 */ 2282 2296 int 2283 2297 xmlParseCharRef(xmlParserCtxtPtr ctxt) { 2284 - unsigned int val = 0; 2298 + int val = 0; 2285 2299 int count = 0; 2286 - unsigned int outofrange = 0; 2287 2300 2288 2301 /* 2289 2302 * Using RAW/CUR/NEXT is okay since we are working on ASCII range here ··· 2310 2323 val = 0; 2311 2324 break; 2312 2325 } 2313 - if (val > 0x10FFFF) 2314 - outofrange = val; 2326 + if (val > 0x110000) 2327 + val = 0x110000; 2315 2328 2316 2329 NEXT; 2317 2330 count++; ··· 2339 2352 val = 0; 2340 2353 break; 2341 2354 } 2342 - if (val > 0x10FFFF) 2343 - outofrange = val; 2355 + if (val > 0x110000) 2356 + val = 0x110000; 2344 2357 2345 2358 NEXT; 2346 2359 count++; ··· 2360 2373 * Characters referred to using character references must match the 2361 2374 * production for Char. 2362 2375 */ 2363 - if ((IS_CHAR(val) && (outofrange == 0))) { 2376 + if (val >= 0x110000) { 2377 + xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, 2378 + "xmlParseCharRef: character reference out of bounds\n", 2379 + val); 2380 + } else if (IS_CHAR(val)) { 2364 2381 return(val); 2365 2382 } else { 2366 2383 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, ··· 2392 2409 xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { 2393 2410 const xmlChar *ptr; 2394 2411 xmlChar cur; 2395 - unsigned int val = 0; 2396 - unsigned int outofrange = 0; 2412 + int val = 0; 2397 2413 2398 2414 if ((str == NULL) || (*str == NULL)) return(0); 2399 2415 ptr = *str; ··· 2413 2429 val = 0; 2414 2430 break; 2415 2431 } 2416 - if (val > 0x10FFFF) 2417 - outofrange = val; 2432 + if (val > 0x110000) 2433 + val = 0x110000; 2418 2434 2419 2435 ptr++; 2420 2436 cur = *ptr; ··· 2432 2448 val = 0; 2433 2449 break; 2434 2450 } 2435 - if (val > 0x10FFFF) 2436 - outofrange = val; 2451 + if (val > 0x110000) 2452 + val = 0x110000; 2437 2453 2438 2454 ptr++; 2439 2455 cur = *ptr; ··· 2451 2467 * Characters referred to using character references must match the 2452 2468 * production for Char. 2453 2469 */ 2454 - if ((IS_CHAR(val) && (outofrange == 0))) { 2470 + if (val >= 0x110000) { 2471 + xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, 2472 + "xmlParseStringCharRef: character reference out of bounds\n", 2473 + val); 2474 + } else if (IS_CHAR(val)) { 2455 2475 return(val); 2456 2476 } else { 2457 2477 xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, ··· 2702 2722 /* 2703 2723 * Note: external parsed entities will not be loaded, 2704 2724 * it is not required for a non-validating parser to 2705 - * complete external PEreferences coming from the 2725 + * complete external PEReferences coming from the 2706 2726 * internal subset 2707 2727 */ 2708 2728 if (((ctxt->options & XML_PARSE_NOENT) != 0) || ··· 3366 3386 /* 3367 3387 * when shrinking to extend the buffer we really need to preserve 3368 3388 * the part of the name we already parsed. Hence rolling back 3369 - * by current lenght. 3389 + * by current length. 3370 3390 */ 3371 3391 ctxt->input->cur -= l; 3372 3392 GROW; ··· 3835 3855 * xmlParseAttValueComplex: 3836 3856 * @ctxt: an XML parser context 3837 3857 * @len: the resulting attribute len 3838 - * @normalize: wether to apply the inner normalization 3858 + * @normalize: whether to apply the inner normalization 3839 3859 * 3840 3860 * parse a value for an attribute, this is the fallback function 3841 3861 * of xmlParseAttValue() when the attribute parsing requires handling ··· 3984 4004 */ 3985 4005 if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && 3986 4006 (ent->content != NULL) && (ent->checked == 0)) { 3987 - unsigned long oldnbent = ctxt->nbentities; 4007 + unsigned long oldnbent = ctxt->nbentities, diff; 3988 4008 3989 4009 ++ctxt->depth; 3990 4010 rep = xmlStringDecodeEntities(ctxt, ent->content, 3991 4011 XML_SUBSTITUTE_REF, 0, 0, 0); 3992 4012 --ctxt->depth; 3993 4013 3994 - ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; 4014 + diff = ctxt->nbentities - oldnbent + 1; 4015 + if (diff > INT_MAX / 2) 4016 + diff = INT_MAX / 2; 4017 + ent->checked = diff * 2; 3995 4018 if (rep != NULL) { 3996 4019 if (xmlStrchr(rep, '<')) 3997 4020 ent->checked |= 1; ··· 4059 4082 4060 4083 /* 4061 4084 * There we potentially risk an overflow, don't allow attribute value of 4062 - * length more than INT_MAX it is a very reasonnable assumption ! 4085 + * length more than INT_MAX it is a very reasonable assumption ! 4063 4086 */ 4064 4087 if (len >= INT_MAX) { 4065 4088 xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, ··· 4664 4687 * xmlParseCommentComplex: 4665 4688 * @ctxt: an XML parser context 4666 4689 * @buf: the already parsed part of the buffer 4667 - * @len: number of bytes filles in the buffer 4690 + * @len: number of bytes in the buffer 4668 4691 * @size: allocated size of the buffer 4669 4692 * 4670 4693 * Skip an XML (SGML) comment <!-- .... --> ··· 4955 4978 } else 4956 4979 xmlFatalErrMsgStr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, 4957 4980 "Double hyphen within comment\n", NULL); 4981 + if (ctxt->instate == XML_PARSER_EOF) { 4982 + xmlFree(buf); 4983 + return; 4984 + } 4958 4985 in++; 4959 4986 ctxt->input->col++; 4960 4987 } ··· 5085 5112 * 5086 5113 * [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' 5087 5114 * 5088 - * The processing is transfered to SAX once parsed. 5115 + * The processing is transferred to SAX once parsed. 5089 5116 */ 5090 5117 5091 5118 void ··· 5501 5528 literal, URI, NULL); 5502 5529 /* 5503 5530 * For expat compatibility in SAX mode. 5504 - * assuming the entity repalcement was asked for 5531 + * assuming the entity replacement was asked for 5505 5532 */ 5506 5533 if ((ctxt->replaceEntities != 0) && 5507 5534 ((ctxt->myDoc == NULL) || ··· 6611 6638 6612 6639 static void 6613 6640 xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { 6614 - int id = ctxt->input->id; 6641 + int *inputIds = NULL; 6642 + size_t inputIdsSize = 0; 6643 + size_t depth = 0; 6615 6644 6616 - SKIP(3); 6617 - SKIP_BLANKS; 6618 - if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) { 6619 - SKIP(7); 6620 - SKIP_BLANKS; 6621 - if (RAW != '[') { 6622 - xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); 6623 - xmlHaltParser(ctxt); 6624 - return; 6625 - } else { 6626 - if (ctxt->input->id != id) { 6627 - xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6628 - "All markup of the conditional section is not" 6629 - " in the same entity\n"); 6630 - } 6631 - NEXT; 6632 - } 6633 - if (xmlParserDebugEntities) { 6634 - if ((ctxt->input != NULL) && (ctxt->input->filename)) 6635 - xmlGenericError(xmlGenericErrorContext, 6636 - "%s(%d): ", ctxt->input->filename, 6637 - ctxt->input->line); 6638 - xmlGenericError(xmlGenericErrorContext, 6639 - "Entering INCLUDE Conditional Section\n"); 6640 - } 6645 + while (ctxt->instate != XML_PARSER_EOF) { 6646 + if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { 6647 + int id = ctxt->input->id; 6641 6648 6642 - SKIP_BLANKS; 6643 - GROW; 6644 - while (((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') || 6645 - (NXT(2) != '>'))) && (ctxt->instate != XML_PARSER_EOF)) { 6646 - const xmlChar *check = CUR_PTR; 6647 - unsigned int cons = ctxt->input->consumed; 6649 + SKIP(3); 6650 + SKIP_BLANKS; 6648 6651 6649 - if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { 6650 - xmlParseConditionalSections(ctxt); 6651 - } else 6652 - xmlParseMarkupDecl(ctxt); 6652 + if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) { 6653 + SKIP(7); 6654 + SKIP_BLANKS; 6655 + if (RAW != '[') { 6656 + xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); 6657 + xmlHaltParser(ctxt); 6658 + goto error; 6659 + } 6660 + if (ctxt->input->id != id) { 6661 + xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6662 + "All markup of the conditional section is" 6663 + " not in the same entity\n"); 6664 + } 6665 + NEXT; 6653 6666 6654 - SKIP_BLANKS; 6655 - GROW; 6667 + if (inputIdsSize <= depth) { 6668 + int *tmp; 6656 6669 6657 - if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { 6658 - xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); 6659 - xmlHaltParser(ctxt); 6660 - break; 6661 - } 6662 - } 6663 - if (xmlParserDebugEntities) { 6664 - if ((ctxt->input != NULL) && (ctxt->input->filename)) 6665 - xmlGenericError(xmlGenericErrorContext, 6666 - "%s(%d): ", ctxt->input->filename, 6667 - ctxt->input->line); 6668 - xmlGenericError(xmlGenericErrorContext, 6669 - "Leaving INCLUDE Conditional Section\n"); 6670 - } 6670 + inputIdsSize = (inputIdsSize == 0 ? 4 : inputIdsSize * 2); 6671 + tmp = (int *) xmlRealloc(inputIds, 6672 + inputIdsSize * sizeof(int)); 6673 + if (tmp == NULL) { 6674 + xmlErrMemory(ctxt, NULL); 6675 + goto error; 6676 + } 6677 + inputIds = tmp; 6678 + } 6679 + inputIds[depth] = id; 6680 + depth++; 6681 + } else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) { 6682 + int state; 6683 + xmlParserInputState instate; 6684 + size_t ignoreDepth = 0; 6671 6685 6672 - } else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) { 6673 - int state; 6674 - xmlParserInputState instate; 6675 - int depth = 0; 6686 + SKIP(6); 6687 + SKIP_BLANKS; 6688 + if (RAW != '[') { 6689 + xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); 6690 + xmlHaltParser(ctxt); 6691 + goto error; 6692 + } 6693 + if (ctxt->input->id != id) { 6694 + xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6695 + "All markup of the conditional section is" 6696 + " not in the same entity\n"); 6697 + } 6698 + NEXT; 6676 6699 6677 - SKIP(6); 6678 - SKIP_BLANKS; 6679 - if (RAW != '[') { 6680 - xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); 6681 - xmlHaltParser(ctxt); 6682 - return; 6683 - } else { 6684 - if (ctxt->input->id != id) { 6685 - xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6686 - "All markup of the conditional section is not" 6687 - " in the same entity\n"); 6688 - } 6689 - NEXT; 6690 - } 6691 - if (xmlParserDebugEntities) { 6692 - if ((ctxt->input != NULL) && (ctxt->input->filename)) 6693 - xmlGenericError(xmlGenericErrorContext, 6694 - "%s(%d): ", ctxt->input->filename, 6695 - ctxt->input->line); 6696 - xmlGenericError(xmlGenericErrorContext, 6697 - "Entering IGNORE Conditional Section\n"); 6698 - } 6700 + /* 6701 + * Parse up to the end of the conditional section but disable 6702 + * SAX event generating DTD building in the meantime 6703 + */ 6704 + state = ctxt->disableSAX; 6705 + instate = ctxt->instate; 6706 + if (ctxt->recovery == 0) ctxt->disableSAX = 1; 6707 + ctxt->instate = XML_PARSER_IGNORE; 6699 6708 6700 - /* 6701 - * Parse up to the end of the conditional section 6702 - * But disable SAX event generating DTD building in the meantime 6703 - */ 6704 - state = ctxt->disableSAX; 6705 - instate = ctxt->instate; 6706 - if (ctxt->recovery == 0) ctxt->disableSAX = 1; 6707 - ctxt->instate = XML_PARSER_IGNORE; 6709 + while (RAW != 0) { 6710 + if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { 6711 + SKIP(3); 6712 + ignoreDepth++; 6713 + /* Check for integer overflow */ 6714 + if (ignoreDepth == 0) { 6715 + xmlErrMemory(ctxt, NULL); 6716 + goto error; 6717 + } 6718 + } else if ((RAW == ']') && (NXT(1) == ']') && 6719 + (NXT(2) == '>')) { 6720 + if (ignoreDepth == 0) 6721 + break; 6722 + SKIP(3); 6723 + ignoreDepth--; 6724 + } else { 6725 + NEXT; 6726 + } 6727 + } 6708 6728 6709 - while (((depth >= 0) && (RAW != 0)) && 6710 - (ctxt->instate != XML_PARSER_EOF)) { 6711 - if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { 6712 - depth++; 6713 - SKIP(3); 6714 - continue; 6715 - } 6716 - if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) { 6717 - if (--depth >= 0) SKIP(3); 6718 - continue; 6719 - } 6720 - NEXT; 6721 - continue; 6722 - } 6729 + ctxt->disableSAX = state; 6730 + ctxt->instate = instate; 6723 6731 6724 - ctxt->disableSAX = state; 6725 - ctxt->instate = instate; 6732 + if (RAW == 0) { 6733 + xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL); 6734 + goto error; 6735 + } 6736 + if (ctxt->input->id != id) { 6737 + xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6738 + "All markup of the conditional section is" 6739 + " not in the same entity\n"); 6740 + } 6741 + SKIP(3); 6742 + } else { 6743 + xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL); 6744 + xmlHaltParser(ctxt); 6745 + goto error; 6746 + } 6747 + } else if ((depth > 0) && 6748 + (RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) { 6749 + depth--; 6750 + if (ctxt->input->id != inputIds[depth]) { 6751 + xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6752 + "All markup of the conditional section is not" 6753 + " in the same entity\n"); 6754 + } 6755 + SKIP(3); 6756 + } else { 6757 + const xmlChar *check = CUR_PTR; 6758 + unsigned int cons = ctxt->input->consumed; 6726 6759 6727 - if (xmlParserDebugEntities) { 6728 - if ((ctxt->input != NULL) && (ctxt->input->filename)) 6729 - xmlGenericError(xmlGenericErrorContext, 6730 - "%s(%d): ", ctxt->input->filename, 6731 - ctxt->input->line); 6732 - xmlGenericError(xmlGenericErrorContext, 6733 - "Leaving IGNORE Conditional Section\n"); 6734 - } 6760 + xmlParseMarkupDecl(ctxt); 6735 6761 6736 - } else { 6737 - xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL); 6738 - xmlHaltParser(ctxt); 6739 - return; 6740 - } 6762 + if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { 6763 + xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); 6764 + xmlHaltParser(ctxt); 6765 + goto error; 6766 + } 6767 + } 6741 6768 6742 - if (RAW == 0) 6743 - SHRINK; 6769 + if (depth == 0) 6770 + break; 6744 6771 6745 - if (RAW == 0) { 6746 - xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL); 6747 - } else { 6748 - if (ctxt->input->id != id) { 6749 - xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, 6750 - "All markup of the conditional section is not in" 6751 - " the same entity\n"); 6752 - } 6753 - if ((ctxt-> instate != XML_PARSER_EOF) && 6754 - ((ctxt->input->cur + 3) <= ctxt->input->end)) 6755 - SKIP(3); 6772 + SKIP_BLANKS; 6773 + GROW; 6756 6774 } 6775 + 6776 + error: 6777 + xmlFree(inputIds); 6757 6778 } 6758 6779 6759 6780 /** ··· 6810 6831 6811 6832 /* 6812 6833 * detect requirement to exit there and act accordingly 6813 - * and avoid having instate overriden later on 6834 + * and avoid having instate overridden later on 6814 6835 */ 6815 6836 if (ctxt->instate == XML_PARSER_EOF) 6816 6837 return; 6817 - 6818 - /* 6819 - * Conditional sections are allowed from entities included 6820 - * by PE References in the internal subset. 6821 - */ 6822 - if ((ctxt->external == 0) && (ctxt->inputNr > 1)) { 6823 - if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { 6824 - xmlParseConditionalSections(ctxt); 6825 - } 6826 - } 6827 6838 6828 6839 ctxt->instate = XML_PARSER_DTD; 6829 6840 } ··· 7009 7020 */ 7010 7021 if (NXT(1) == '#') { 7011 7022 int i = 0; 7012 - xmlChar out[10]; 7023 + xmlChar out[16]; 7013 7024 int hex = NXT(2); 7014 7025 int value = xmlParseCharRef(ctxt); 7015 7026 ··· 7086 7097 ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) && 7087 7098 ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) || 7088 7099 (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) { 7089 - unsigned long oldnbent = ctxt->nbentities; 7100 + unsigned long oldnbent = ctxt->nbentities, diff; 7090 7101 7091 7102 /* 7092 7103 * This is a bit hackish but this seems the best ··· 7127 7138 * Store the number of entities needing parsing for this entity 7128 7139 * content and do checkings 7129 7140 */ 7130 - ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; 7141 + diff = ctxt->nbentities - oldnbent + 1; 7142 + if (diff > INT_MAX / 2) 7143 + diff = INT_MAX / 2; 7144 + ent->checked = diff * 2; 7131 7145 if ((ent->content != NULL) && (xmlStrchr(ent->content, '<'))) 7132 7146 ent->checked |= 1; 7133 7147 if (ret == XML_ERR_ENTITY_LOOP) { ··· 7675 7689 } 7676 7690 7677 7691 /* 7678 - * Increate the number of entity references parsed 7692 + * Increase the number of entity references parsed 7679 7693 */ 7680 7694 ctxt->nbentities++; 7681 7695 ··· 7851 7865 NEXT; 7852 7866 7853 7867 /* 7854 - * Increate the number of entity references parsed 7868 + * Increase the number of entity references parsed 7855 7869 */ 7856 7870 ctxt->nbentities++; 7857 7871 ··· 8117 8131 ptr++; 8118 8132 8119 8133 /* 8120 - * Increate the number of entity references parsed 8134 + * Increase the number of entity references parsed 8121 8135 */ 8122 8136 ctxt->nbentities++; 8123 8137 ··· 8285 8299 xmlParseMarkupDecl(ctxt); 8286 8300 xmlParsePEReference(ctxt); 8287 8301 8302 + /* 8303 + * Conditional sections are allowed from external entities included 8304 + * by PE References in the internal subset. 8305 + */ 8306 + if ((ctxt->inputNr > 1) && (ctxt->input->filename != NULL) && 8307 + (RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { 8308 + xmlParseConditionalSections(ctxt); 8309 + } 8310 + 8288 8311 if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { 8289 8312 xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, 8290 8313 "xmlParseInternalSubset: error detected in Markup declaration\n"); ··· 8713 8736 if (l == NULL) { 8714 8737 xmlChar *tmp; 8715 8738 8739 + if (ctxt->instate == XML_PARSER_EOF) 8740 + return(NULL); 8716 8741 xmlNsErr(ctxt, XML_NS_ERR_QNAME, 8717 8742 "Failed to parse QName '%s:'\n", p, NULL, NULL); 8718 8743 l = xmlParseNmtoken(ctxt); 8719 - if (l == NULL) 8744 + if (l == NULL) { 8745 + if (ctxt->instate == XML_PARSER_EOF) 8746 + return(NULL); 8720 8747 tmp = xmlBuildQName(BAD_CAST "", p, NULL, 0); 8721 - else { 8748 + } else { 8722 8749 tmp = xmlBuildQName(l, p, NULL, 0); 8723 8750 xmlFree((char *)l); 8724 8751 } ··· 8741 8768 *prefix = p; 8742 8769 return(l); 8743 8770 } 8771 + if (ctxt->instate == XML_PARSER_EOF) 8772 + return(NULL); 8744 8773 tmp = xmlBuildQName(BAD_CAST "", l, NULL, 0); 8745 8774 l = xmlDictLookup(ctxt->dict, tmp, -1); 8746 8775 if (tmp != NULL) xmlFree(tmp); ··· 8840 8869 * caller if it was copied, this can be detected by val[*len] == 0. 8841 8870 */ 8842 8871 8872 + #define GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) \ 8873 + const xmlChar *oldbase = ctxt->input->base;\ 8874 + GROW;\ 8875 + if (ctxt->instate == XML_PARSER_EOF)\ 8876 + return(NULL);\ 8877 + if (oldbase != ctxt->input->base) {\ 8878 + ptrdiff_t delta = ctxt->input->base - oldbase;\ 8879 + start = start + delta;\ 8880 + in = in + delta;\ 8881 + }\ 8882 + end = ctxt->input->end; 8883 + 8843 8884 static xmlChar * 8844 8885 xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, 8845 8886 int normalize) ··· 8869 8910 end = ctxt->input->end; 8870 8911 start = in; 8871 8912 if (in >= end) { 8872 - const xmlChar *oldbase = ctxt->input->base; 8873 - GROW; 8874 - if (oldbase != ctxt->input->base) { 8875 - long delta = ctxt->input->base - oldbase; 8876 - start = start + delta; 8877 - in = in + delta; 8878 - } 8879 - end = ctxt->input->end; 8913 + GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) 8880 8914 } 8881 8915 if (normalize) { 8882 8916 /* ··· 8893 8927 in++; 8894 8928 start = in; 8895 8929 if (in >= end) { 8896 - const xmlChar *oldbase = ctxt->input->base; 8897 - GROW; 8898 - if (ctxt->instate == XML_PARSER_EOF) 8899 - return(NULL); 8900 - if (oldbase != ctxt->input->base) { 8901 - long delta = ctxt->input->base - oldbase; 8902 - start = start + delta; 8903 - in = in + delta; 8904 - } 8905 - end = ctxt->input->end; 8930 + GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) 8906 8931 if (((in - start) > XML_MAX_TEXT_LENGTH) && 8907 8932 ((ctxt->options & XML_PARSE_HUGE) == 0)) { 8908 8933 xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, ··· 8916 8941 col++; 8917 8942 if ((*in++ == 0x20) && (*in == 0x20)) break; 8918 8943 if (in >= end) { 8919 - const xmlChar *oldbase = ctxt->input->base; 8920 - GROW; 8921 - if (ctxt->instate == XML_PARSER_EOF) 8922 - return(NULL); 8923 - if (oldbase != ctxt->input->base) { 8924 - long delta = ctxt->input->base - oldbase; 8925 - start = start + delta; 8926 - in = in + delta; 8927 - } 8928 - end = ctxt->input->end; 8944 + GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) 8929 8945 if (((in - start) > XML_MAX_TEXT_LENGTH) && 8930 8946 ((ctxt->options & XML_PARSE_HUGE) == 0)) { 8931 8947 xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, ··· 8954 8970 if (ctxt->instate == XML_PARSER_EOF) 8955 8971 return(NULL); 8956 8972 if (oldbase != ctxt->input->base) { 8957 - long delta = ctxt->input->base - oldbase; 8973 + ptrdiff_t delta = ctxt->input->base - oldbase; 8958 8974 start = start + delta; 8959 8975 in = in + delta; 8960 8976 last = last + delta; ··· 8981 8997 in++; 8982 8998 col++; 8983 8999 if (in >= end) { 8984 - const xmlChar *oldbase = ctxt->input->base; 8985 - GROW; 8986 - if (ctxt->instate == XML_PARSER_EOF) 8987 - return(NULL); 8988 - if (oldbase != ctxt->input->base) { 8989 - long delta = ctxt->input->base - oldbase; 8990 - start = start + delta; 8991 - in = in + delta; 8992 - } 8993 - end = ctxt->input->end; 9000 + GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) 8994 9001 if (((in - start) > XML_MAX_TEXT_LENGTH) && 8995 9002 ((ctxt->options & XML_PARSE_HUGE) == 0)) { 8996 9003 xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, ··· 9084 9091 if (normalize) { 9085 9092 /* 9086 9093 * Sometimes a second normalisation pass for spaces is needed 9087 - * but that only happens if charrefs or entities refernces 9094 + * but that only happens if charrefs or entities references 9088 9095 * have been used in the attribute value, i.e. the attribute 9089 9096 * value have been extracted in an allocated string already. 9090 9097 */ ··· 9247 9254 xmlErrMemory(ctxt, "dictionary allocation failure"); 9248 9255 if ((attvalue != NULL) && (alloc != 0)) 9249 9256 xmlFree(attvalue); 9250 - return(NULL); 9257 + localname = NULL; 9258 + goto done; 9251 9259 } 9252 9260 if (*URL != 0) { 9253 9261 uri = xmlParseURI((const char *) URL); ··· 9497 9505 9498 9506 if ((atts == NULL) || (nbatts + 5 > maxatts)) { 9499 9507 if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) { 9500 - return(NULL); 9508 + localname = NULL; 9509 + goto done; 9501 9510 } 9502 9511 maxatts = ctxt->maxatts; 9503 9512 atts = ctxt->atts; ··· 9807 9816 9808 9817 void 9809 9818 xmlParseContent(xmlParserCtxtPtr ctxt) { 9819 + int nameNr = ctxt->nameNr; 9820 + 9810 9821 GROW; 9811 9822 while ((RAW != 0) && 9812 - ((RAW != '<') || (NXT(1) != '/')) && 9813 9823 (ctxt->instate != XML_PARSER_EOF)) { 9814 9824 const xmlChar *test = CUR_PTR; 9815 9825 unsigned int cons = ctxt->input->consumed; ··· 9843 9853 * Fourth case : a sub-element. 9844 9854 */ 9845 9855 else if (*cur == '<') { 9846 - xmlParseElement(ctxt); 9856 + if (NXT(1) == '/') { 9857 + if (ctxt->nameNr <= nameNr) 9858 + break; 9859 + xmlParseElementEnd(ctxt); 9860 + } else { 9861 + xmlParseElementStart(ctxt); 9862 + } 9847 9863 } 9848 9864 9849 9865 /* ··· 9878 9894 * xmlParseElement: 9879 9895 * @ctxt: an XML parser context 9880 9896 * 9881 - * parse an XML element, this is highly recursive 9897 + * parse an XML element 9882 9898 * 9883 9899 * [39] element ::= EmptyElemTag | STag content ETag 9884 9900 * ··· 9890 9906 9891 9907 void 9892 9908 xmlParseElement(xmlParserCtxtPtr ctxt) { 9909 + if (xmlParseElementStart(ctxt) != 0) 9910 + return; 9911 + xmlParseContent(ctxt); 9912 + if (ctxt->instate == XML_PARSER_EOF) 9913 + return; 9914 + xmlParseElementEnd(ctxt); 9915 + } 9916 + 9917 + /** 9918 + * xmlParseElementStart: 9919 + * @ctxt: an XML parser context 9920 + * 9921 + * Parse the start of an XML element. Returns -1 in case of error, 0 if an 9922 + * opening tag was parsed, 1 if an empty element was parsed. 9923 + */ 9924 + static int 9925 + xmlParseElementStart(xmlParserCtxtPtr ctxt) { 9893 9926 const xmlChar *name; 9894 9927 const xmlChar *prefix = NULL; 9895 9928 const xmlChar *URI = NULL; ··· 9904 9937 "Excessive depth in document: %d use XML_PARSE_HUGE option\n", 9905 9938 xmlParserMaxDepth); 9906 9939 xmlHaltParser(ctxt); 9907 - return; 9940 + return(-1); 9908 9941 } 9909 9942 9910 9943 /* Capture start position */ ··· 9931 9964 name = xmlParseStartTag(ctxt); 9932 9965 #endif /* LIBXML_SAX1_ENABLED */ 9933 9966 if (ctxt->instate == XML_PARSER_EOF) 9934 - return; 9967 + return(-1); 9935 9968 if (name == NULL) { 9936 9969 spacePop(ctxt); 9937 - return; 9970 + return(-1); 9938 9971 } 9939 - namePush(ctxt, name); 9972 + if (ctxt->sax2) 9973 + nameNsPush(ctxt, name, prefix, URI, ctxt->nsNr - nsNr); 9974 + #ifdef LIBXML_SAX1_ENABLED 9975 + else 9976 + namePush(ctxt, name); 9977 + #endif /* LIBXML_SAX1_ENABLED */ 9940 9978 ret = ctxt->node; 9941 9979 9942 9980 #ifdef LIBXML_VALID_ENABLED ··· 9977 10015 node_info.node = ret; 9978 10016 xmlParserAddNodeInfo(ctxt, &node_info); 9979 10017 } 9980 - return; 10018 + return(1); 9981 10019 } 9982 10020 if (RAW == '>') { 9983 10021 NEXT1; ··· 10005 10043 node_info.node = ret; 10006 10044 xmlParserAddNodeInfo(ctxt, &node_info); 10007 10045 } 10008 - return; 10046 + return(-1); 10009 10047 } 10010 10048 10011 - /* 10012 - * Parse the content of the element: 10013 - */ 10014 - xmlParseContent(ctxt); 10015 - if (ctxt->instate == XML_PARSER_EOF) 10016 - return; 10017 - if (!IS_BYTE_CHAR(RAW)) { 10018 - xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NOT_FINISHED, 10019 - "Premature end of data in tag %s line %d\n", 10020 - name, line, NULL); 10049 + return(0); 10050 + } 10021 10051 10022 - /* 10023 - * end of parsing of this node. 10024 - */ 10025 - nodePop(ctxt); 10026 - namePop(ctxt); 10027 - spacePop(ctxt); 10028 - if (nsNr != ctxt->nsNr) 10029 - nsPop(ctxt, ctxt->nsNr - nsNr); 10030 - return; 10031 - } 10052 + /** 10053 + * xmlParseElementEnd: 10054 + * @ctxt: an XML parser context 10055 + * 10056 + * Parse the end of an XML element. 10057 + */ 10058 + static void 10059 + xmlParseElementEnd(xmlParserCtxtPtr ctxt) { 10060 + xmlParserNodeInfo node_info; 10061 + xmlNodePtr ret = ctxt->node; 10062 + 10063 + if (ctxt->nameNr <= 0) 10064 + return; 10032 10065 10033 10066 /* 10034 10067 * parse the end of tag: '</' should be here. 10035 10068 */ 10036 10069 if (ctxt->sax2) { 10037 - xmlParseEndTag2(ctxt, prefix, URI, line, ctxt->nsNr - nsNr, tlen); 10070 + const xmlChar *prefix = ctxt->pushTab[ctxt->nameNr * 3 - 3]; 10071 + const xmlChar *URI = ctxt->pushTab[ctxt->nameNr * 3 - 2]; 10072 + int nsNr = (ptrdiff_t) ctxt->pushTab[ctxt->nameNr * 3 - 1]; 10073 + xmlParseEndTag2(ctxt, prefix, URI, 0, nsNr, 0); 10038 10074 namePop(ctxt); 10039 10075 } 10040 10076 #ifdef LIBXML_SAX1_ENABLED 10041 - else 10042 - xmlParseEndTag1(ctxt, line); 10077 + else 10078 + xmlParseEndTag1(ctxt, 0); 10043 10079 #endif /* LIBXML_SAX1_ENABLED */ 10044 10080 10045 10081 /* ··· 10281 10317 } 10282 10318 10283 10319 /* 10284 - * UTF-16 encoding stwich has already taken place at this stage, 10320 + * UTF-16 encoding switch has already taken place at this stage, 10285 10321 * more over the little-endian/big-endian selection is already done 10286 10322 */ 10287 10323 if ((encoding != NULL) && ··· 11164 11200 else { 11165 11201 /* 11166 11202 * If we are operating on converted input, try to flush 11167 - * remainng chars to avoid them stalling in the non-converted 11203 + * remaining chars to avoid them stalling in the non-converted 11168 11204 * buffer. But do not do this in document start where 11169 11205 * encoding="..." may not have been read and we work on a 11170 11206 * guessed encoding. ··· 12356 12392 return(NULL); 12357 12393 } 12358 12394 ctxt->dictNames = 1; 12359 - ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 * sizeof(xmlChar *)); 12360 - if (ctxt->pushTab == NULL) { 12361 - xmlErrMemory(ctxt, NULL); 12362 - xmlFreeParserInputBuffer(buf); 12363 - xmlFreeParserCtxt(ctxt); 12364 - return(NULL); 12365 - } 12366 12395 if (sax != NULL) { 12367 12396 #ifdef LIBXML_SAX1_ENABLED 12368 12397 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) ··· 13898 13927 xmlFreeParserCtxt(ctxt); 13899 13928 newDoc->intSubset = NULL; 13900 13929 newDoc->extSubset = NULL; 13901 - newDoc->oldNs = NULL; 13930 + if(doc != NULL) 13931 + newDoc->oldNs = NULL; 13902 13932 xmlFreeDoc(newDoc); 13903 13933 13904 13934 return(ret); ··· 14006 14036 */ 14007 14037 ctxt->input_id = pctx->input_id + 1; 14008 14038 } 14039 + 14040 + /* Don't read from stdin. */ 14041 + if (xmlStrcmp(URL, BAD_CAST "-") == 0) 14042 + URL = BAD_CAST "./-"; 14009 14043 14010 14044 uri = xmlBuildURI(URL, base); 14011 14045 ··· 14938 14972 } 14939 14973 14940 14974 xmlCtxtReset(ctxt); 14941 - 14942 - if (ctxt->pushTab == NULL) { 14943 - ctxt->pushTab = (void **) xmlMalloc(ctxt->nameMax * 3 * 14944 - sizeof(xmlChar *)); 14945 - if (ctxt->pushTab == NULL) { 14946 - xmlErrMemory(ctxt, NULL); 14947 - xmlFreeParserInputBuffer(buf); 14948 - return(1); 14949 - } 14950 - } 14951 14975 14952 14976 if (filename == NULL) { 14953 14977 ctxt->directory = NULL;
+4 -4
sdk/lib/3rdparty/libxml2/parserInternals.c
··· 703 703 /* 704 704 * An encoding problem may arise from a truncated input buffer 705 705 * splitting a character in the middle. In that case do not raise 706 - * an error but return 0 to endicate an end of stream problem 706 + * an error but return 0 to indicate an end of stream problem 707 707 */ 708 708 if (ctxt->input->end - ctxt->input->cur < 4) { 709 709 *len = 0; ··· 816 816 /* 817 817 * An encoding problem may arise from a truncated input buffer 818 818 * splitting a character in the middle. In that case do not raise 819 - * an error but return 0 to endicate an end of stream problem 819 + * an error but return 0 to indicate an end of stream problem 820 820 */ 821 821 if ((ctxt == NULL) || (ctxt->input == NULL) || 822 822 (ctxt->input->end - ctxt->input->cur < 4)) { ··· 1093 1093 } 1094 1094 } 1095 1095 /* 1096 - * TODO: We could recover from errors in external entites if we 1096 + * TODO: We could recover from errors in external entities if we 1097 1097 * didn't stop the parser. But most callers of this function don't 1098 1098 * check the return value. 1099 1099 */ ··· 1138 1138 if (input->buf != NULL) { 1139 1139 if (input->buf->encoder != NULL) { 1140 1140 /* 1141 - * Check in case the auto encoding detetection triggered 1141 + * Check in case the auto encoding detection triggered 1142 1142 * in already. 1143 1143 */ 1144 1144 if (input->buf->encoder == handler)
+10 -7
sdk/lib/3rdparty/libxml2/pattern.c
··· 1 1 /* 2 - * pattern.c: Implemetation of selectors for nodes 2 + * pattern.c: Implementation of selectors for nodes 3 3 * 4 4 * Reference: 5 5 * http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/ ··· 55 55 /* 56 56 * NOTE: Those private flags (XML_STREAM_xxx) are used 57 57 * in _xmlStreamCtxt->flag. They extend the public 58 - * xmlPatternFlags, so be carefull not to interfere with the 58 + * xmlPatternFlags, so be careful not to interfere with the 59 59 * reserved values for xmlPatternFlags. 60 60 */ 61 61 #define XML_STREAM_FINAL_IS_ANY_NODE 1<<14 ··· 229 229 */ 230 230 void 231 231 xmlFreePattern(xmlPatternPtr comp) { 232 + xmlFreePatternList(comp); 233 + } 234 + 235 + static void 236 + xmlFreePatternInternal(xmlPatternPtr comp) { 232 237 xmlStepOpPtr op; 233 238 int i; 234 239 235 240 if (comp == NULL) 236 241 return; 237 - if (comp->next != NULL) 238 - xmlFreePattern(comp->next); 239 242 if (comp->stream != NULL) 240 243 xmlFreeStreamComp(comp->stream); 241 244 if (comp->pattern != NULL) ··· 273 276 cur = comp; 274 277 comp = comp->next; 275 278 cur->next = NULL; 276 - xmlFreePattern(cur); 279 + xmlFreePatternInternal(cur); 277 280 } 278 281 } 279 282 ··· 742 745 * xmlPatScanLiteral: 743 746 * @ctxt: the XPath Parser context 744 747 * 745 - * Parse an XPath Litteral: 748 + * Parse an XPath Literal: 746 749 * 747 750 * [29] Literal ::= '"' [^"]* '"' 748 751 * | "'" [^']* "'" ··· 1973 1976 } else { 1974 1977 /* 1975 1978 * If there are "//", then we need to process every "//" 1976 - * occuring in the states, plus any other state for this 1979 + * occurring in the states, plus any other state for this 1977 1980 * level. 1978 1981 */ 1979 1982 stepNr = stream->states[2 * i];
+53 -37
sdk/lib/3rdparty/libxml2/relaxng.c
··· 125 125 XML_RELAXNG_EXCEPT, /* except present in nameclass defs */ 126 126 XML_RELAXNG_TEXT, /* textual content */ 127 127 XML_RELAXNG_ELEMENT, /* an element */ 128 - XML_RELAXNG_DATATYPE, /* extenal data type definition */ 129 - XML_RELAXNG_PARAM, /* extenal data type parameter */ 130 - XML_RELAXNG_VALUE, /* value from an extenal data type definition */ 128 + XML_RELAXNG_DATATYPE, /* external data type definition */ 129 + XML_RELAXNG_PARAM, /* external data type parameter */ 130 + XML_RELAXNG_VALUE, /* value from an external data type definition */ 131 131 XML_RELAXNG_LIST, /* a list of patterns */ 132 - XML_RELAXNG_ATTRIBUTE, /* an attrbute following a pattern */ 132 + XML_RELAXNG_ATTRIBUTE, /* an attribute following a pattern */ 133 133 XML_RELAXNG_DEF, /* a definition */ 134 134 XML_RELAXNG_REF, /* reference to a definition */ 135 135 XML_RELAXNG_EXTERNALREF, /* reference to an external def */ ··· 228 228 xmlDocPtr document; 229 229 230 230 int defNr; /* number of defines used */ 231 - int defMax; /* number of defines aloocated */ 231 + int defMax; /* number of defines allocated */ 232 232 xmlRelaxNGDefinePtr *defTab; /* pointer to the allocated definitions */ 233 233 234 234 const char *buffer; ··· 1128 1128 /** 1129 1129 * xmlRelaxNGFreeStates: 1130 1130 * @ctxt: a Relax-NG validation context 1131 - * @states: teh container 1131 + * @states: the container 1132 1132 * 1133 1133 * Free a RelaxNG validation state container 1134 1134 */ ··· 1340 1340 * 1341 1341 * Compare the validation states for equality 1342 1342 * 1343 - * Returns 1 if equald, 0 otherwise 1343 + * Returns 1 if equal, 0 otherwise 1344 1344 */ 1345 1345 static int 1346 1346 xmlRelaxNGEqualValidState(xmlRelaxNGValidCtxtPtr ctxt ATTRIBUTE_UNUSED, ··· 2815 2815 /** 2816 2816 * xmlRelaxNGInitTypes: 2817 2817 * 2818 - * Initilize the default type libraries. 2818 + * Initialize the default type libraries. 2819 2819 * 2820 2820 * Returns 0 in case of success and -1 in case of error. 2821 2821 */ ··· 2878 2878 xmlRelaxNGDefinePtr def); 2879 2879 2880 2880 /** 2881 - * xmlRelaxNGIsCompileable: 2881 + * xmlRelaxNGIsCompilable: 2882 2882 * @define: the definition to check 2883 2883 * 2884 2884 * Check if a definition is nullable. ··· 2886 2886 * Returns 1 if yes, 0 if no and -1 in case of error 2887 2887 */ 2888 2888 static int 2889 - xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def) 2889 + xmlRelaxNGIsCompilable(xmlRelaxNGDefinePtr def) 2890 2890 { 2891 2891 int ret = -1; 2892 2892 ··· 2901 2901 return (0); 2902 2902 switch (def->type) { 2903 2903 case XML_RELAXNG_NOOP: 2904 - ret = xmlRelaxNGIsCompileable(def->content); 2904 + ret = xmlRelaxNGIsCompilable(def->content); 2905 2905 break; 2906 2906 case XML_RELAXNG_TEXT: 2907 2907 case XML_RELAXNG_EMPTY: ··· 2909 2909 break; 2910 2910 case XML_RELAXNG_ELEMENT: 2911 2911 /* 2912 - * Check if the element content is compileable 2912 + * Check if the element content is compilable 2913 2913 */ 2914 2914 if (((def->dflags & IS_NOT_COMPILABLE) == 0) && 2915 2915 ((def->dflags & IS_COMPILABLE) == 0)) { ··· 2917 2917 2918 2918 list = def->content; 2919 2919 while (list != NULL) { 2920 - ret = xmlRelaxNGIsCompileable(list); 2920 + ret = xmlRelaxNGIsCompilable(list); 2921 2921 if (ret != 1) 2922 2922 break; 2923 2923 list = list->next; ··· 2943 2943 def->name); 2944 2944 } else { 2945 2945 xmlGenericError(xmlGenericErrorContext, 2946 - "Problem in RelaxNGIsCompileable for element %s\n", 2946 + "Problem in RelaxNGIsCompilable for element %s\n", 2947 2947 def->name); 2948 2948 } 2949 2949 #endif 2950 2950 } 2951 2951 /* 2952 - * All elements return a compileable status unless they 2952 + * All elements return a compilable status unless they 2953 2953 * are generic like anyName 2954 2954 */ 2955 2955 if ((def->nameClass != NULL) || (def->name == NULL)) ··· 2968 2968 def->depth = -20; 2969 2969 list = def->content; 2970 2970 while (list != NULL) { 2971 - ret = xmlRelaxNGIsCompileable(list); 2971 + ret = xmlRelaxNGIsCompilable(list); 2972 2972 if (ret != 1) 2973 2973 break; 2974 2974 list = list->next; ··· 2986 2986 2987 2987 list = def->content; 2988 2988 while (list != NULL) { 2989 - ret = xmlRelaxNGIsCompileable(list); 2989 + ret = xmlRelaxNGIsCompilable(list); 2990 2990 if (ret != 1) 2991 2991 break; 2992 2992 list = list->next; ··· 3011 3011 #ifdef DEBUG_COMPILE 3012 3012 if (ret == 1) { 3013 3013 xmlGenericError(xmlGenericErrorContext, 3014 - "RelaxNGIsCompileable %s : true\n", 3014 + "RelaxNGIsCompilable %s : true\n", 3015 3015 xmlRelaxNGDefName(def)); 3016 3016 } else if (ret == 0) { 3017 3017 xmlGenericError(xmlGenericErrorContext, 3018 - "RelaxNGIsCompileable %s : false\n", 3018 + "RelaxNGIsCompilable %s : false\n", 3019 3019 xmlRelaxNGDefName(def)); 3020 3020 } else { 3021 3021 xmlGenericError(xmlGenericErrorContext, 3022 - "Problem in RelaxNGIsCompileable %s\n", 3022 + "Problem in RelaxNGIsCompilable %s\n", 3023 3023 xmlRelaxNGDefName(def)); 3024 3024 } 3025 3025 #endif ··· 3047 3047 3048 3048 switch (def->type) { 3049 3049 case XML_RELAXNG_START: 3050 - if ((xmlRelaxNGIsCompileable(def) == 1) && (def->depth != -25)) { 3050 + if ((xmlRelaxNGIsCompilable(def) == 1) && (def->depth != -25)) { 3051 3051 xmlAutomataPtr oldam = ctxt->am; 3052 3052 xmlAutomataStatePtr oldstate = ctxt->state; 3053 3053 ··· 3273 3273 3274 3274 if ((def->type == XML_RELAXNG_START) || 3275 3275 (def->type == XML_RELAXNG_ELEMENT)) { 3276 - ret = xmlRelaxNGIsCompileable(def); 3276 + ret = xmlRelaxNGIsCompilable(def); 3277 3277 if ((def->dflags & IS_COMPILABLE) && (def->depth != -25)) { 3278 3278 ctxt->am = NULL; 3279 3279 ret = xmlRelaxNGCompile(ctxt, def); ··· 3478 3478 * 3479 3479 * Applies algorithm from 4.3. datatypeLibrary attribute 3480 3480 * 3481 - * Returns the datatypeLibary value or NULL if not found 3481 + * Returns the datatypeLibrary value or NULL if not found 3482 3482 */ 3483 3483 static xmlChar * 3484 3484 xmlRelaxNGGetDataTypeLibrary(xmlRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED, ··· 3788 3788 * that if both lists do not accept the same QNames, it returns 1 3789 3789 * If the 2 lists can accept the same QName the comparison returns 0 3790 3790 * 3791 - * Returns 1 disttinct, 0 if equal 3791 + * Returns 1 distinct, 0 if equal 3792 3792 */ 3793 3793 static int 3794 3794 xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1, ··· 3889 3889 * is that if both lists do not accept the same QNames, it returns 1 3890 3890 * If the 2 lists can accept the same QName the comparison returns 0 3891 3891 * 3892 - * Returns 1 disttinct, 0 if equal 3892 + * Returns 1 distinct, 0 if equal 3893 3893 */ 3894 3894 static int 3895 3895 xmlRelaxNGCompareElemDefLists(xmlRelaxNGParserCtxtPtr ctxt ··· 4743 4743 /** 4744 4744 * xmlRelaxNGProcessExternalRef: 4745 4745 * @ctxt: the parser context 4746 - * @node: the externlRef node 4746 + * @node: the externalRef node 4747 4747 * 4748 - * Process and compile an externlRef node 4748 + * Process and compile an externalRef node 4749 4749 * 4750 4750 * Returns the xmlRelaxNGDefinePtr or NULL in case of error 4751 4751 */ ··· 5548 5548 while (nodes != NULL) { 5549 5549 if (IS_RELAXNG(nodes, "element")) { 5550 5550 cur = xmlRelaxNGParseElement(ctxt, nodes); 5551 + if (cur == NULL) 5552 + return (NULL); 5551 5553 if (def == NULL) { 5552 5554 def = last = cur; 5553 5555 } else { 5554 5556 if ((group == 1) && (def->type == XML_RELAXNG_ELEMENT) && 5555 5557 (def == last)) { 5556 5558 def = xmlRelaxNGNewDefine(ctxt, nodes); 5559 + if (def == NULL) 5560 + return (NULL); 5557 5561 def->type = XML_RELAXNG_GROUP; 5558 5562 def->content = last; 5559 5563 } ··· 6012 6016 * @parent: the parent definition 6013 6017 * @prev: the previous sibling definition 6014 6018 * 6015 - * Try to unlink a definition. If not possble make it a NOOP 6019 + * Try to unlink a definition. If not possible make it a NOOP 6016 6020 * 6017 6021 * Returns the new prev definition 6018 6022 */ ··· 6395 6399 NULL, NULL); 6396 6400 } 6397 6401 if ((!(flags & XML_RELAXNG_IN_ONEORMORE)) 6398 - && (cur->name == NULL)) { 6402 + && cur->name == NULL 6403 + /* following is checking alternative name class readiness 6404 + in case it went the "choice" route */ 6405 + && cur->nameClass == NULL) { 6399 6406 if (cur->ns == NULL) { 6400 6407 xmlRngPErr(ctxt, cur->node, XML_RNGP_ANYNAME_ATTR_ANCESTOR, 6401 6408 "Found anyName attribute without oneOrMore ancestor\n", ··· 6659 6666 * @node: the root node of the RelaxNG schema 6660 6667 * 6661 6668 * parse a Relax-NG definition resource and build an internal 6662 - * xmlRelaxNG struture which can be used to validate instances. 6669 + * xmlRelaxNG structure which can be used to validate instances. 6663 6670 * 6664 6671 * Returns the internal XML RelaxNG structure built or 6665 6672 * NULL in case of error ··· 7490 7497 * @ctxt: a Relax-NG parser context 7491 7498 * 7492 7499 * parse a schema definition resource and build an internal 7493 - * XML Shema struture which can be used to validate instances. 7500 + * XML Schema structure which can be used to validate instances. 7494 7501 * 7495 7502 * Returns the internal XML RelaxNG structure built from the resource or 7496 7503 * NULL in case of error ··· 8603 8610 * @type: the datatype definition 8604 8611 * @node: the node 8605 8612 * 8606 - * Validate the given value against the dataype 8613 + * Validate the given value against the datatype 8607 8614 * 8608 8615 * Returns 0 if the validation succeeded or an error code. 8609 8616 */ ··· 9476 9483 xmlRelaxNGFreeValidState(ctxt, oldstate); 9477 9484 oldstate = ctxt->state; 9478 9485 ctxt->state = NULL; 9479 - if (cur != NULL) { 9486 + if (cur != NULL 9487 + /* there's a nasty violation of context-free unambiguities, 9488 + since in open-name-class context, interleave in the 9489 + production shall finish without caring about anything 9490 + else that is OK to follow in that case -- it would 9491 + otherwise get marked as "extra content" and would 9492 + hence fail the validation, hence this perhaps 9493 + dirty attempt to rectify such a situation */ 9494 + && (define->parent->type != XML_RELAXNG_DEF 9495 + || !xmlStrEqual(define->parent->name, 9496 + (const xmlChar *) "open-name-class"))) { 9480 9497 VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name); 9481 9498 ret = -1; 9482 9499 ctxt->state = oldstate; ··· 9749 9766 * Find the "best" state in the ctxt->states list of states to report 9750 9767 * errors about. I.e. a state with no element left in the child list 9751 9768 * or the one with the less attributes left. 9752 - * This is called only if a falidation error was detected 9769 + * This is called only if a validation error was detected 9753 9770 * 9754 9771 * Returns the index of the "best" state or -1 in case of error 9755 9772 */ ··· 9891 9908 ctxt->depth++; 9892 9909 switch (define->type) { 9893 9910 case XML_RELAXNG_EMPTY: 9894 - xmlRelaxNGSkipIgnored(ctxt, node); 9895 9911 ret = 0; 9896 9912 break; 9897 9913 case XML_RELAXNG_NOT_ALLOWED: ··· 10357 10373 10358 10374 /* 10359 10375 * Something we can optimize cleanly there is only one 10360 - * possble branch out ! 10376 + * possible branch out ! 10361 10377 */ 10362 10378 if ((node->type == XML_TEXT_NODE) || 10363 10379 (node->type == XML_CDATA_SECTION_NODE)) { ··· 10610 10626 if (define->name != NULL) 10611 10627 xmlGenericError(xmlGenericErrorContext, "%s ", define->name); 10612 10628 if (ret == 0) 10613 - xmlGenericError(xmlGenericErrorContext, "suceeded\n"); 10629 + xmlGenericError(xmlGenericErrorContext, "succeeded\n"); 10614 10630 else 10615 10631 xmlGenericError(xmlGenericErrorContext, "failed\n"); 10616 10632 #endif
+3 -2
sdk/lib/3rdparty/libxml2/save.h
··· 1 1 /* 2 2 * Summary: Internal Interfaces for saving in libxml2 3 3 * Description: this module describes a few interfaces which were 4 - * addded along with the API changes in 2.9.0 4 + * added along with the API changes in 2.9.0 5 5 * those are private routines at this point 6 6 * 7 7 * Copy: See Copyright for the status of this software. ··· 25 25 void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem); 26 26 void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr); 27 27 void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent); 28 + #endif 29 + 28 30 xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input); 29 - #endif 30 31 31 32 #ifdef __cplusplus 32 33 }
+4 -4
sdk/lib/3rdparty/libxml2/schematron.c
··· 1068 1068 * @ctxt: a schema validation context 1069 1069 * 1070 1070 * parse a schema definition resource and build an internal 1071 - * XML Shema struture which can be used to validate instances. 1071 + * XML Schema structure which can be used to validate instances. 1072 1072 * 1073 1073 * Returns the internal XML Schematron structure built from the resource or 1074 1074 * NULL in case of error ··· 1287 1287 * Build the string being reported to the user. 1288 1288 * 1289 1289 * Returns a report string or NULL in case of error. The string needs 1290 - * to be deallocated by teh caller 1290 + * to be deallocated by the caller 1291 1291 */ 1292 1292 static xmlChar * 1293 1293 xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, ··· 1591 1591 * xmlSchematronRunTest: 1592 1592 * @ctxt: the schema validation context 1593 1593 * @test: the current test 1594 - * @instance: the document instace tree 1594 + * @instance: the document instance tree 1595 1595 * @cur: the current node in the instance 1596 1596 * 1597 1597 * Validate a rule against a tree instance at a given position ··· 1655 1655 /** 1656 1656 * xmlSchematronValidateDoc: 1657 1657 * @ctxt: the schema validation context 1658 - * @instance: the document instace tree 1658 + * @instance: the document instance tree 1659 1659 * 1660 1660 * Validate a tree instance against the schematron 1661 1661 *
+4 -4
sdk/lib/3rdparty/libxml2/threads.c
··· 27 27 #ifdef HAVE_PTHREAD_H 28 28 #include <pthread.h> 29 29 #elif defined HAVE_WIN32_THREADS 30 - //#define WIN32_LEAN_AND_MEAN 31 - //#include <windows.h> 30 + #define WIN32_LEAN_AND_MEAN 31 + #include <windows.h> 32 32 #ifndef HAVE_COMPILER_TLS 33 33 #include <process.h> 34 34 #endif ··· 82 82 83 83 /* 84 84 * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree 85 - * to avoid some crazyness since xmlMalloc/xmlFree may actually 85 + * to avoid some craziness since xmlMalloc/xmlFree may actually 86 86 * be hosted on allocated blocks needing them for the allocation ... 87 87 */ 88 88 ··· 239 239 if (acquire_sem(tok->sem) != B_NO_ERROR) { 240 240 #ifdef DEBUG_THREADS 241 241 xmlGenericError(xmlGenericErrorContext, 242 - "xmlMutexLock():BeOS:Couldn't aquire semaphore\n"); 242 + "xmlMutexLock():BeOS:Couldn't acquire semaphore\n"); 243 243 #endif 244 244 } 245 245 tok->tid = find_thread(NULL);
+4 -3
sdk/lib/3rdparty/libxml2/timsort.h
··· 59 59 #define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;} 60 60 61 61 62 - /* Common, type-agnosting functions and constants that we don't want to declare twice. */ 62 + /* Common, type-agnostic functions and constants that we don't want to declare twice. */ 63 63 #ifndef SORT_COMMON_H 64 64 #define SORT_COMMON_H 65 65 ··· 74 74 static int compute_minrun(const uint64_t); 75 75 76 76 #ifndef CLZ 77 - #ifdef __GNUC__ 77 + #if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3)) 78 78 #define CLZ __builtin_clzll 79 79 #else 80 80 ··· 404 404 j = curr + A; 405 405 k = curr + A + B; 406 406 407 - while (k-- > curr) { 407 + while (k > curr) { 408 + k--; 408 409 if ((i > 0) && (j > curr)) { 409 410 if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) { 410 411 dst[k] = dst[--j];
+53 -37
sdk/lib/3rdparty/libxml2/tree.c
··· 59 59 ************************************************************************/ 60 60 61 61 static xmlNsPtr 62 - xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); 62 + xmlNewReconciledNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); 63 63 64 64 static xmlChar* xmlGetPropNodeValueInternal(const xmlAttr *prop); 65 65 ··· 181 181 * @dtd: A pointer to the DTD to search 182 182 * @name: The entity name 183 183 * 184 - * Do an entity lookup in the DTD pararmeter entity hash table and 184 + * Do an entity lookup in the DTD parameter entity hash table and 185 185 * return the corresponding entity, if found. 186 186 * 187 187 * Returns A pointer to the entity structure or NULL if not found. ··· 2950 2950 * Add a new attribute after @prev using @cur as base attribute. 2951 2951 * When inserting before @cur, @prev is passed as @cur->prev. 2952 2952 * When inserting after @cur, @prev is passed as @cur. 2953 - * If an existing attribute is found it is detroyed prior to adding @prop. 2953 + * If an existing attribute is found it is destroyed prior to adding @prop. 2954 2954 * 2955 2955 * Returns the attribute being inserted or NULL in case of error. 2956 2956 */ ··· 3664 3664 void 3665 3665 xmlFreeNodeList(xmlNodePtr cur) { 3666 3666 xmlNodePtr next; 3667 + xmlNodePtr parent; 3667 3668 xmlDictPtr dict = NULL; 3669 + size_t depth = 0; 3668 3670 3669 3671 if (cur == NULL) return; 3670 3672 if (cur->type == XML_NAMESPACE_DECL) { ··· 3680 3682 return; 3681 3683 } 3682 3684 if (cur->doc != NULL) dict = cur->doc->dict; 3683 - while (cur != NULL) { 3685 + while (1) { 3686 + while ((cur->children != NULL) && 3687 + (cur->type != XML_DTD_NODE) && 3688 + (cur->type != XML_ENTITY_REF_NODE)) { 3689 + cur = cur->children; 3690 + depth += 1; 3691 + } 3692 + 3684 3693 next = cur->next; 3694 + parent = cur->parent; 3685 3695 if (cur->type != XML_DTD_NODE) { 3686 3696 3687 3697 if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) 3688 3698 xmlDeregisterNodeDefaultValue(cur); 3689 3699 3690 - if ((cur->children != NULL) && 3691 - (cur->type != XML_ENTITY_REF_NODE)) 3692 - xmlFreeNodeList(cur->children); 3693 3700 if (((cur->type == XML_ELEMENT_NODE) || 3694 3701 (cur->type == XML_XINCLUDE_START) || 3695 3702 (cur->type == XML_XINCLUDE_END)) && ··· 3720 3727 DICT_FREE(cur->name) 3721 3728 xmlFree(cur); 3722 3729 } 3723 - cur = next; 3730 + 3731 + if (next != NULL) { 3732 + cur = next; 3733 + } else { 3734 + if ((depth == 0) || (parent == NULL)) 3735 + break; 3736 + depth -= 1; 3737 + cur = parent; 3738 + cur->children = NULL; 3739 + } 3724 3740 } 3725 3741 } 3726 3742 ··· 4050 4066 } else { 4051 4067 /* 4052 4068 * we have to find something appropriate here since 4053 - * we cant be sure, that the namespce we found is identified 4069 + * we cant be sure, that the namespace we found is identified 4054 4070 * by the prefix 4055 4071 */ 4056 4072 if (xmlStrEqual(ns->href, cur->ns->href)) { ··· 4058 4074 ret->ns = ns; 4059 4075 } else { 4060 4076 /* 4061 - * we are in trouble: we need a new reconcilied namespace. 4077 + * we are in trouble: we need a new reconciled namespace. 4062 4078 * This is expensive 4063 4079 */ 4064 - ret->ns = xmlNewReconciliedNs(target->doc, target, cur->ns); 4080 + ret->ns = xmlNewReconciledNs(target->doc, target, cur->ns); 4065 4081 } 4066 4082 } 4067 4083 ··· 4154 4170 * say RPM:Copyright without changing the namespace pointer to 4155 4171 * something else can produce stale links. One way to do it is 4156 4172 * to keep a reference counter but this doesn't work as soon 4157 - * as one move the element or the subtree out of the scope of 4158 - * the existing namespace. The actual solution seems to add 4173 + * as one moves the element or the subtree out of the scope of 4174 + * the existing namespace. The actual solution seems to be to add 4159 4175 * a copy of the namespace at the top of the copied tree if 4160 4176 * not available in the subtree. 4161 4177 * Hence two functions, the public front-end call the inner ones ··· 4280 4296 while (root->parent != NULL) root = root->parent; 4281 4297 ret->ns = xmlNewNs(root, ns->href, ns->prefix); 4282 4298 } else { 4283 - ret->ns = xmlNewReconciliedNs(doc, ret, node->ns); 4299 + ret->ns = xmlNewReconciledNs(doc, ret, node->ns); 4284 4300 } 4285 4301 } else { 4286 4302 /* ··· 4719 4735 4720 4736 /* 4721 4737 * Thumbler index computation 4722 - * TODO: the ocurence test seems bogus for namespaced names 4738 + * TODO: the occurrence test seems bogus for namespaced names 4723 4739 */ 4724 4740 tmp = cur->prev; 4725 4741 while (tmp != NULL) { ··· 6214 6230 } 6215 6231 6216 6232 /** 6217 - * xmlNewReconciliedNs: 6233 + * xmlNewReconciledNs: 6218 6234 * @doc: the document 6219 6235 * @tree: a node expected to hold the new namespace 6220 6236 * @ns: the original namespace ··· 6227 6243 * Returns the (new) namespace definition or NULL in case of error 6228 6244 */ 6229 6245 static xmlNsPtr 6230 - xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) { 6246 + xmlNewReconciledNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) { 6231 6247 xmlNsPtr def; 6232 6248 xmlChar prefix[50]; 6233 6249 int counter = 1; ··· 6235 6251 if ((tree == NULL) || (tree->type != XML_ELEMENT_NODE)) { 6236 6252 #ifdef DEBUG_TREE 6237 6253 xmlGenericError(xmlGenericErrorContext, 6238 - "xmlNewReconciliedNs : tree == NULL\n"); 6254 + "xmlNewReconciledNs : tree == NULL\n"); 6239 6255 #endif 6240 6256 return(NULL); 6241 6257 } 6242 6258 if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) { 6243 6259 #ifdef DEBUG_TREE 6244 6260 xmlGenericError(xmlGenericErrorContext, 6245 - "xmlNewReconciliedNs : ns == NULL\n"); 6261 + "xmlNewReconciledNs : ns == NULL\n"); 6246 6262 #endif 6247 6263 return(NULL); 6248 6264 } ··· 6344 6360 /* 6345 6361 * OK we need to recreate a new namespace definition 6346 6362 */ 6347 - n = xmlNewReconciliedNs(doc, tree, node->ns); 6363 + n = xmlNewReconciledNs(doc, tree, node->ns); 6348 6364 if (n != NULL) { /* :-( what if else ??? */ 6349 6365 /* 6350 6366 * check if we need to grow the cache buffers. ··· 6373 6389 } 6374 6390 } 6375 6391 /* 6376 - * now check for namespace hold by attributes on the node. 6392 + * now check for namespace held by attributes on the node. 6377 6393 */ 6378 6394 if (node->type == XML_ELEMENT_NODE) { 6379 6395 attr = node->properties; ··· 6408 6424 /* 6409 6425 * OK we need to recreate a new namespace definition 6410 6426 */ 6411 - n = xmlNewReconciliedNs(doc, tree, attr->ns); 6427 + n = xmlNewReconciledNs(doc, tree, attr->ns); 6412 6428 if (n != NULL) { /* :-( what if else ??? */ 6413 6429 /* 6414 6430 * check if we need to grow the cache buffers. ··· 7961 7977 * Creates or reuses an xmlNs struct on doc->oldNs with 7962 7978 * the given prefix and namespace name. 7963 7979 * 7964 - * Returns the aquired ns struct or NULL in case of an API 7980 + * Returns the acquired ns struct or NULL in case of an API 7965 7981 * or internal error. 7966 7982 */ 7967 7983 static xmlNsPtr ··· 8575 8591 } 8576 8592 8577 8593 /* 8578 - * xmlDOMWrapNSNormAquireNormalizedNs: 8594 + * xmlDOMWrapNSNormAcquireNormalizedNs: 8579 8595 * @doc: the doc 8580 8596 * @elem: the element-node to declare namespaces on 8581 8597 * @ns: the ns-struct to use for the search ··· 8594 8610 * Returns 0 if succeeded, -1 otherwise and on API/internal errors. 8595 8611 */ 8596 8612 static int 8597 - xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, 8613 + xmlDOMWrapNSNormAcquireNormalizedNs(xmlDocPtr doc, 8598 8614 xmlNodePtr elem, 8599 8615 xmlNsPtr ns, 8600 8616 xmlNsPtr *retNs, ··· 8893 8909 } 8894 8910 } 8895 8911 /* 8896 - * Aquire a normalized ns-decl and add it to the map. 8912 + * Acquire a normalized ns-decl and add it to the map. 8897 8913 */ 8898 - if (xmlDOMWrapNSNormAquireNormalizedNs(doc, curElem, 8914 + if (xmlDOMWrapNSNormAcquireNormalizedNs(doc, curElem, 8899 8915 cur->ns, &ns, 8900 8916 &nsMap, depth, 8901 8917 ancestorsOnly, ··· 9033 9049 nsMap = (xmlNsMapPtr) ctxt->namespaceMap; 9034 9050 /* 9035 9051 * Disable search for ns-decls in the parent-axis of the 9036 - * desination element, if: 9052 + * destination element, if: 9037 9053 * 1) there's no destination parent 9038 9054 * 2) custom ns-reference handling is used 9039 9055 */ ··· 9178 9194 cur->ns = ns; 9179 9195 } else { 9180 9196 /* 9181 - * Aquire a normalized ns-decl and add it to the map. 9197 + * Acquire a normalized ns-decl and add it to the map. 9182 9198 */ 9183 - if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc, 9199 + if (xmlDOMWrapNSNormAcquireNormalizedNs(destDoc, 9184 9200 /* ns-decls on curElem or on destDoc->oldNs */ 9185 9201 destParent ? curElem : NULL, 9186 9202 cur->ns, &ns, ··· 9234 9250 goto leave_node; 9235 9251 case XML_ENTITY_REF_NODE: 9236 9252 /* 9237 - * Remove reference to the entitity-node. 9253 + * Remove reference to the entity-node. 9238 9254 */ 9239 9255 cur->content = NULL; 9240 9256 cur->children = NULL; ··· 9468 9484 } 9469 9485 memset(clone, 0, sizeof(xmlNode)); 9470 9486 /* 9471 - * Set hierachical links. 9487 + * Set hierarchical links. 9472 9488 */ 9473 9489 if (resultClone != NULL) { 9474 9490 clone->parent = parentClone; ··· 9492 9508 } 9493 9509 memset(clone, 0, sizeof(xmlAttr)); 9494 9510 /* 9495 - * Set hierachical links. 9511 + * Set hierarchical links. 9496 9512 * TODO: Change this to add to the end of attributes. 9497 9513 */ 9498 9514 if (resultClone != NULL) { ··· 9720 9736 clone->ns = ns; 9721 9737 } else { 9722 9738 /* 9723 - * Aquire a normalized ns-decl and add it to the map. 9739 + * Acquire a normalized ns-decl and add it to the map. 9724 9740 */ 9725 - if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc, 9741 + if (xmlDOMWrapNSNormAcquireNormalizedNs(destDoc, 9726 9742 /* ns-decls on curElem or on destDoc->oldNs */ 9727 9743 destParent ? curElem : NULL, 9728 9744 cur->ns, &ns, ··· 9959 9975 break; 9960 9976 case XML_ENTITY_REF_NODE: 9961 9977 /* 9962 - * Remove reference to the entitity-node. 9978 + * Remove reference to the entity-node. 9963 9979 */ 9964 9980 cur->content = NULL; 9965 9981 cur->children = NULL; ··· 10097 10113 break; 10098 10114 case XML_ENTITY_REF_NODE: 10099 10115 /* 10100 - * Remove reference to the entitity-node. 10116 + * Remove reference to the entity-node. 10101 10117 */ 10102 10118 node->content = NULL; 10103 10119 node->children = NULL;
+2 -2
sdk/lib/3rdparty/libxml2/trio.c
··· 2610 2610 * 2611 2611 * The accuracy [...] is implementation defined, as is the accuracy 2612 2612 * of the conversion between floating-point internal representations 2613 - * and string representations performed by the libray routine in 2613 + * and string representations performed by the library routine in 2614 2614 * <stdio.h>" 2615 2615 */ 2616 2616 /* FIXME: handle all instances of constant long-double number (L) ··· 5899 5899 } 5900 5900 if (trio_equal(doubleString, NAN_UPPER)) 5901 5901 { 5902 - /* NaN must not have a preceeding + nor - */ 5902 + /* NaN must not have a preceding + nor - */ 5903 5903 if (flags & FLAGS_LONGDOUBLE) 5904 5904 { 5905 5905 *((trio_long_double_t *)target) = trio_nan();
+2 -2
sdk/lib/3rdparty/libxml2/trionan.c
··· 92 92 93 93 /* 94 94 * In ANSI/IEEE 754-1985 64-bits double format numbers have the 95 - * following properties (amoungst others) 95 + * following properties (amongst others) 96 96 * 97 97 * o FLT_RADIX == 2: binary encoding 98 98 * o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used ··· 327 327 328 328 if (result == 0.0) { 329 329 330 - #if defined(TRIO_COMPILER_SUPPORTS_C99) && !defined(__clang__) 330 + #if defined(TRIO_COMPILER_SUPPORTS_C99) && (!defined(__REACTOS__) || !defined(__clang__)) 331 331 result = nan(""); 332 332 333 333 #elif defined(NAN) && defined(__STDC_IEC_559__)
+11 -9
sdk/lib/3rdparty/libxml2/uri.c
··· 22 22 * MAX_URI_LENGTH: 23 23 * 24 24 * The definition of the URI regexp in the above RFC has no size limit 25 - * In practice they are usually relativey short except for the 25 + * In practice they are usually relatively short except for the 26 26 * data URI scheme as defined in RFC 2397. Even for data URI the usual 27 27 * maximum size before hitting random practical limits is around 64 KB 28 28 * and 4KB is usually a maximum admitted limit for proper operations. ··· 325 325 xmlParse3986Port(xmlURIPtr uri, const char **str) 326 326 { 327 327 const char *cur = *str; 328 - unsigned port = 0; /* unsigned for defined overflow behavior */ 328 + int port = 0; 329 329 330 330 if (ISA_DIGIT(cur)) { 331 331 while (ISA_DIGIT(cur)) { 332 332 port = port * 10 + (*cur - '0'); 333 + if (port > 99999999) 334 + port = 99999999; 333 335 334 336 cur++; 335 337 } 336 338 if (uri != NULL) 337 - uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */ 339 + uri->port = port; 338 340 *str = cur; 339 341 return(0); 340 342 } ··· 436 438 437 439 host = cur; 438 440 /* 439 - * IPv6 and future adressing scheme are enclosed between brackets 441 + * IPv6 and future addressing scheme are enclosed between brackets 440 442 */ 441 443 if (*cur == '[') { 442 444 cur++; ··· 1456 1458 goto done_cd; 1457 1459 (out++)[0] = (cur++)[0]; 1458 1460 } 1459 - /* nomalize // */ 1461 + /* normalize // */ 1460 1462 while ((cur[0] == '/') && (cur[1] == '/')) 1461 1463 cur++; 1462 1464 ··· 2150 2152 * http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif 2151 2153 * 2152 2154 * 2153 - * Note: if the URI reference is really wierd or complicated, it may be 2155 + * Note: if the URI reference is really weird or complicated, it may be 2154 2156 * worthwhile to first convert it into a "nice" one by calling 2155 2157 * xmlBuildURI (using 'base') before calling this routine, 2156 2158 * since this routine (for reasonable efficiency) assumes URI has ··· 2461 2463 /* allocate space for leading '/' + path + string terminator */ 2462 2464 uri->path = xmlMallocAtomic(len + 2); 2463 2465 if (uri->path == NULL) { 2464 - xmlFreeURI(uri); /* Guard agains 'out of memory' */ 2466 + xmlFreeURI(uri); /* Guard against 'out of memory' */ 2465 2467 return(NULL); 2466 2468 } 2467 2469 /* Put in leading '/' plus path */ ··· 2476 2478 } 2477 2479 p = uri->path; 2478 2480 } 2479 - /* Now change all occurences of '\' to '/' */ 2481 + /* Now change all occurrences of '\' to '/' */ 2480 2482 while (*p != '\0') { 2481 2483 if (*p == '\\') 2482 2484 *p = '/'; ··· 2526 2528 return(NULL); 2527 2529 #if defined(_WIN32) && !defined(__CYGWIN__) 2528 2530 /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) 2529 - If 'cal' is a valid URI allready then we are done here, as continuing would make 2531 + If 'cal' is a valid URI already then we are done here, as continuing would make 2530 2532 it invalid. */ 2531 2533 if ((uri = xmlParseURI((const char *) cal)) != NULL) { 2532 2534 xmlFreeURI(uri);
+118 -75
sdk/lib/3rdparty/libxml2/valid.c
··· 1099 1099 */ 1100 1100 void 1101 1101 xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { 1102 - xmlElementContentPtr next; 1103 1102 xmlDictPtr dict = NULL; 1103 + size_t depth = 0; 1104 1104 1105 + if (cur == NULL) 1106 + return; 1105 1107 if (doc != NULL) 1106 1108 dict = doc->dict; 1107 1109 1108 - while (cur != NULL) { 1109 - next = cur->c2; 1110 + while (1) { 1111 + xmlElementContentPtr parent; 1112 + 1113 + while ((cur->c1 != NULL) || (cur->c2 != NULL)) { 1114 + cur = (cur->c1 != NULL) ? cur->c1 : cur->c2; 1115 + depth += 1; 1116 + } 1117 + 1110 1118 switch (cur->type) { 1111 1119 case XML_ELEMENT_CONTENT_PCDATA: 1112 1120 case XML_ELEMENT_CONTENT_ELEMENT: ··· 1119 1127 NULL); 1120 1128 return; 1121 1129 } 1122 - if (cur->c1 != NULL) xmlFreeDocElementContent(doc, cur->c1); 1123 1130 if (dict) { 1124 1131 if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name))) 1125 1132 xmlFree((xmlChar *) cur->name); ··· 1129 1136 if (cur->name != NULL) xmlFree((xmlChar *) cur->name); 1130 1137 if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix); 1131 1138 } 1139 + parent = cur->parent; 1140 + if ((depth == 0) || (parent == NULL)) { 1141 + xmlFree(cur); 1142 + break; 1143 + } 1144 + if (cur == parent->c1) 1145 + parent->c1 = NULL; 1146 + else 1147 + parent->c2 = NULL; 1132 1148 xmlFree(cur); 1133 - cur = next; 1149 + 1150 + if (parent->c2 != NULL) { 1151 + cur = parent->c2; 1152 + } else { 1153 + depth -= 1; 1154 + cur = parent; 1155 + } 1134 1156 } 1135 1157 } 1136 1158 ··· 1148 1170 1149 1171 #ifdef LIBXML_OUTPUT_ENABLED 1150 1172 /** 1173 + * xmlDumpElementOccur: 1174 + * @buf: An XML buffer 1175 + * @cur: An element table 1176 + * 1177 + * Dump the occurence operator of an element. 1178 + */ 1179 + static void 1180 + xmlDumpElementOccur(xmlBufferPtr buf, xmlElementContentPtr cur) { 1181 + switch (cur->ocur) { 1182 + case XML_ELEMENT_CONTENT_ONCE: 1183 + break; 1184 + case XML_ELEMENT_CONTENT_OPT: 1185 + xmlBufferWriteChar(buf, "?"); 1186 + break; 1187 + case XML_ELEMENT_CONTENT_MULT: 1188 + xmlBufferWriteChar(buf, "*"); 1189 + break; 1190 + case XML_ELEMENT_CONTENT_PLUS: 1191 + xmlBufferWriteChar(buf, "+"); 1192 + break; 1193 + } 1194 + } 1195 + 1196 + /** 1151 1197 * xmlDumpElementContent: 1152 1198 * @buf: An XML buffer 1153 1199 * @content: An element table 1154 - * @glob: 1 if one must print the englobing parenthesis, 0 otherwise 1155 1200 * 1156 1201 * This will dump the content of the element table as an XML DTD definition 1157 1202 */ 1158 1203 static void 1159 - xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) { 1204 + xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content) { 1205 + xmlElementContentPtr cur; 1206 + 1160 1207 if (content == NULL) return; 1161 1208 1162 - if (glob) xmlBufferWriteChar(buf, "("); 1163 - switch (content->type) { 1164 - case XML_ELEMENT_CONTENT_PCDATA: 1165 - xmlBufferWriteChar(buf, "#PCDATA"); 1166 - break; 1167 - case XML_ELEMENT_CONTENT_ELEMENT: 1168 - if (content->prefix != NULL) { 1169 - xmlBufferWriteCHAR(buf, content->prefix); 1170 - xmlBufferWriteChar(buf, ":"); 1171 - } 1172 - xmlBufferWriteCHAR(buf, content->name); 1173 - break; 1174 - case XML_ELEMENT_CONTENT_SEQ: 1175 - if ((content->c1 != NULL) && 1176 - ((content->c1->type == XML_ELEMENT_CONTENT_OR) || 1177 - (content->c1->type == XML_ELEMENT_CONTENT_SEQ))) 1178 - xmlDumpElementContent(buf, content->c1, 1); 1179 - else 1180 - xmlDumpElementContent(buf, content->c1, 0); 1181 - xmlBufferWriteChar(buf, " , "); 1182 - if ((content->c2 != NULL) && 1183 - ((content->c2->type == XML_ELEMENT_CONTENT_OR) || 1184 - ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) && 1185 - (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))) 1186 - xmlDumpElementContent(buf, content->c2, 1); 1187 - else 1188 - xmlDumpElementContent(buf, content->c2, 0); 1189 - break; 1190 - case XML_ELEMENT_CONTENT_OR: 1191 - if ((content->c1 != NULL) && 1192 - ((content->c1->type == XML_ELEMENT_CONTENT_OR) || 1193 - (content->c1->type == XML_ELEMENT_CONTENT_SEQ))) 1194 - xmlDumpElementContent(buf, content->c1, 1); 1195 - else 1196 - xmlDumpElementContent(buf, content->c1, 0); 1197 - xmlBufferWriteChar(buf, " | "); 1198 - if ((content->c2 != NULL) && 1199 - ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) || 1200 - ((content->c2->type == XML_ELEMENT_CONTENT_OR) && 1201 - (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))) 1202 - xmlDumpElementContent(buf, content->c2, 1); 1203 - else 1204 - xmlDumpElementContent(buf, content->c2, 0); 1205 - break; 1206 - default: 1207 - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, 1208 - "Internal: ELEMENT content corrupted invalid type\n", 1209 - NULL); 1210 - } 1211 - if (glob) 1212 - xmlBufferWriteChar(buf, ")"); 1213 - switch (content->ocur) { 1214 - case XML_ELEMENT_CONTENT_ONCE: 1215 - break; 1216 - case XML_ELEMENT_CONTENT_OPT: 1217 - xmlBufferWriteChar(buf, "?"); 1218 - break; 1219 - case XML_ELEMENT_CONTENT_MULT: 1220 - xmlBufferWriteChar(buf, "*"); 1221 - break; 1222 - case XML_ELEMENT_CONTENT_PLUS: 1223 - xmlBufferWriteChar(buf, "+"); 1224 - break; 1225 - } 1209 + xmlBufferWriteChar(buf, "("); 1210 + cur = content; 1211 + 1212 + do { 1213 + if (cur == NULL) return; 1214 + 1215 + switch (cur->type) { 1216 + case XML_ELEMENT_CONTENT_PCDATA: 1217 + xmlBufferWriteChar(buf, "#PCDATA"); 1218 + break; 1219 + case XML_ELEMENT_CONTENT_ELEMENT: 1220 + if (cur->prefix != NULL) { 1221 + xmlBufferWriteCHAR(buf, cur->prefix); 1222 + xmlBufferWriteChar(buf, ":"); 1223 + } 1224 + xmlBufferWriteCHAR(buf, cur->name); 1225 + break; 1226 + case XML_ELEMENT_CONTENT_SEQ: 1227 + case XML_ELEMENT_CONTENT_OR: 1228 + if ((cur != content) && 1229 + (cur->parent != NULL) && 1230 + ((cur->type != cur->parent->type) || 1231 + (cur->ocur != XML_ELEMENT_CONTENT_ONCE))) 1232 + xmlBufferWriteChar(buf, "("); 1233 + cur = cur->c1; 1234 + continue; 1235 + default: 1236 + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, 1237 + "Internal: ELEMENT cur corrupted invalid type\n", 1238 + NULL); 1239 + } 1240 + 1241 + while (cur != content) { 1242 + xmlElementContentPtr parent = cur->parent; 1243 + 1244 + if (parent == NULL) return; 1245 + 1246 + if (((cur->type == XML_ELEMENT_CONTENT_OR) || 1247 + (cur->type == XML_ELEMENT_CONTENT_SEQ)) && 1248 + ((cur->type != parent->type) || 1249 + (cur->ocur != XML_ELEMENT_CONTENT_ONCE))) 1250 + xmlBufferWriteChar(buf, ")"); 1251 + xmlDumpElementOccur(buf, cur); 1252 + 1253 + if (cur == parent->c1) { 1254 + if (parent->type == XML_ELEMENT_CONTENT_SEQ) 1255 + xmlBufferWriteChar(buf, " , "); 1256 + else if (parent->type == XML_ELEMENT_CONTENT_OR) 1257 + xmlBufferWriteChar(buf, " | "); 1258 + 1259 + cur = parent->c2; 1260 + break; 1261 + } 1262 + 1263 + cur = parent; 1264 + } 1265 + } while (cur != content); 1266 + 1267 + xmlBufferWriteChar(buf, ")"); 1268 + xmlDumpElementOccur(buf, content); 1226 1269 } 1227 1270 1228 1271 /** ··· 1703 1746 } 1704 1747 xmlBufferWriteCHAR(buf, elem->name); 1705 1748 xmlBufferWriteChar(buf, " "); 1706 - xmlDumpElementContent(buf, elem->content, 1); 1749 + xmlDumpElementContent(buf, elem->content); 1707 1750 xmlBufferWriteChar(buf, ">\n"); 1708 1751 break; 1709 1752 case XML_ELEMENT_TYPE_ELEMENT: ··· 1714 1757 } 1715 1758 xmlBufferWriteCHAR(buf, elem->name); 1716 1759 xmlBufferWriteChar(buf, " "); 1717 - xmlDumpElementContent(buf, elem->content, 1); 1760 + xmlDumpElementContent(buf, elem->content); 1718 1761 xmlBufferWriteChar(buf, ">\n"); 1719 1762 break; 1720 1763 default: ··· 2640 2683 ret->doc = doc; 2641 2684 if ((ctxt != NULL) && (ctxt->vstateNr != 0)) { 2642 2685 /* 2643 - * Operating in streaming mode, attr is gonna disapear 2686 + * Operating in streaming mode, attr is gonna disappear 2644 2687 */ 2645 2688 if (doc->dict != NULL) 2646 2689 ret->name = xmlDictLookup(doc->dict, attr->name, -1); ··· 2968 3011 ret->value = xmlStrdup(value); 2969 3012 if ((ctxt != NULL) && (ctxt->vstateNr != 0)) { 2970 3013 /* 2971 - * Operating in streaming mode, attr is gonna disapear 3014 + * Operating in streaming mode, attr is gonna disappear 2972 3015 */ 2973 3016 ret->name = xmlStrdup(attr->name); 2974 3017 ret->attr = NULL;
+18 -8
sdk/lib/3rdparty/libxml2/xinclude.c
··· 449 449 450 450 xmlCtxtUseOptions(pctxt, ctxt->parseFlags | XML_PARSE_DTDLOAD); 451 451 452 + /* Don't read from stdin. */ 453 + if ((URL != NULL) && (strcmp(URL, "-") == 0)) 454 + URL = "./-"; 455 + 452 456 inputStream = xmlLoadExternalEntity(URL, NULL, pctxt); 453 457 if (inputStream == NULL) { 454 458 xmlFreeParserCtxt(pctxt); ··· 667 671 int i; 668 672 669 673 /* 670 - * Avoid recursion in already substitued resources 674 + * Avoid recursion in already substituted resources 671 675 for (i = 0;i < ctxt->urlNr;i++) { 672 676 if (xmlStrEqual(doc->URL, ctxt->urlTab[i])) 673 677 return; ··· 752 756 * @txt: the new text node 753 757 * @url: the associated URL 754 758 * 755 - * Add a new txtument to the list 759 + * Add a new text node to the list 756 760 */ 757 761 static void 758 762 xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) { ··· 1258 1262 * @doc: the including doc 1259 1263 * @nr: the entity name 1260 1264 * 1261 - * Inplements the merge of one entity 1265 + * Implements the merge of one entity 1262 1266 */ 1263 1267 static void 1264 1268 xmlXIncludeMergeEntity(void *payload, void *vdata, ··· 1335 1339 * @doc: the including doc 1336 1340 * @from: the included doc 1337 1341 * 1338 - * Inplements the entity merge 1342 + * Implements the entity merge 1339 1343 * 1340 1344 * Returns 0 if merge succeeded, -1 if some processing failed 1341 1345 */ ··· 1806 1810 xmlParserInputPtr inputStream; 1807 1811 int xinclude_multibyte_fallback_used = 0; 1808 1812 1813 + /* Don't read from stdin. */ 1814 + if (xmlStrcmp(url, BAD_CAST "-") == 0) 1815 + url = BAD_CAST "./-"; 1816 + 1809 1817 /* 1810 1818 * Check the URL and remove any fragment identifier 1811 1819 */ ··· 1914 1922 1915 1923 cur = xmlStringCurrentChar(NULL, &content[i], &l); 1916 1924 if (!IS_CHAR(cur)) { 1917 - /* Handle splitted multibyte char at buffer boundary */ 1925 + /* Handle split multibyte char at buffer boundary */ 1918 1926 if (((len - i) < 4) && (!xinclude_multibyte_fallback_used)) { 1919 1927 xinclude_multibyte_fallback_used = 1; 1920 1928 xmlBufShrink(buf->buffer, i); ··· 1923 1931 xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, 1924 1932 XML_XINCLUDE_INVALID_CHAR, 1925 1933 "%s contains invalid char\n", URL); 1934 + xmlFreeParserCtxt(pctxt); 1926 1935 xmlFreeParserInputBuffer(buf); 1927 1936 xmlFree(URL); 1928 1937 return(-1); ··· 1963 1972 xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) { 1964 1973 xmlXIncludeCtxtPtr newctxt; 1965 1974 int ret = 0; 1975 + int oldNbErrors = ctxt->nbErrors; 1966 1976 1967 1977 if ((fallback == NULL) || (fallback->type == XML_NAMESPACE_DECL) || 1968 1978 (ctxt == NULL)) ··· 1979 1989 newctxt->base = xmlStrdup(ctxt->base); /* Inherit the base from the existing context */ 1980 1990 xmlXIncludeSetFlags(newctxt, ctxt->parseFlags); 1981 1991 ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children); 1982 - if (ctxt->nbErrors > 0) 1992 + if (ctxt->nbErrors > oldNbErrors) 1983 1993 ret = -1; 1984 1994 else if (ret > 0) 1985 1995 ret = 0; /* xmlXIncludeDoProcess can return +ve number */ ··· 2133 2143 xmlNodePtr children; 2134 2144 2135 2145 /* 2136 - * Time to try a fallback if availble 2146 + * Time to try a fallback if available 2137 2147 */ 2138 2148 #ifdef DEBUG_XINCLUDE 2139 2149 xmlGenericError(xmlGenericErrorContext, "error looking for fallback\n"); ··· 2178 2188 * @ctxt: an XInclude context 2179 2189 * @nr: the node number 2180 2190 * 2181 - * Inplement the infoset replacement for the given node 2191 + * Implement the infoset replacement for the given node 2182 2192 * 2183 2193 * Returns 0 if substitution succeeded, -1 if some processing failed 2184 2194 */
+41 -18
sdk/lib/3rdparty/libxml2/xmlIO.c
··· 189 189 "already connected", /* EISCONN */ 190 190 "connection refused", /* ECONNREFUSED */ 191 191 "unreachable network", /* ENETUNREACH */ 192 - "adddress in use", /* EADDRINUSE */ 192 + "address in use", /* EADDRINUSE */ 193 193 "already in use", /* EALREADY */ 194 - "unknown address familly", /* EAFNOSUPPORT */ 194 + "unknown address family", /* EAFNOSUPPORT */ 195 195 }; 196 196 197 197 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) ··· 2387 2387 if (encoder != NULL) { 2388 2388 ret->conv = xmlBufCreateSize(4000); 2389 2389 if (ret->conv == NULL) { 2390 + xmlBufFree(ret->buffer); 2390 2391 xmlFree(ret); 2391 2392 return(NULL); 2392 2393 } ··· 2439 2440 if (encoder != NULL) { 2440 2441 ret->conv = xmlBufCreateSize(4000); 2441 2442 if (ret->conv == NULL) { 2443 + xmlBufFree(ret->buffer); 2442 2444 xmlFree(ret); 2443 2445 return(NULL); 2444 2446 } ··· 3339 3341 int nbchars = 0; /* number of chars to output to I/O */ 3340 3342 int ret; /* return from function call */ 3341 3343 int written = 0; /* number of char written to I/O so far */ 3342 - int chunk; /* number of byte curreent processed from buf */ 3344 + int chunk; /* number of byte current processed from buf */ 3343 3345 3344 3346 if ((out == NULL) || (out->error)) return(-1); 3345 3347 if (len < 0) return(0); ··· 3376 3378 out->error = XML_IO_ENCODER; 3377 3379 return(-1); 3378 3380 } 3379 - nbchars = xmlBufUse(out->conv); 3381 + if (out->writecallback) 3382 + nbchars = xmlBufUse(out->conv); 3383 + else 3384 + nbchars = ret; 3380 3385 } else { 3381 3386 ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk); 3382 3387 if (ret != 0) 3383 3388 return(-1); 3384 - nbchars = xmlBufUse(out->buffer); 3389 + if (out->writecallback) 3390 + nbchars = xmlBufUse(out->buffer); 3391 + else 3392 + nbchars = chunk; 3385 3393 } 3386 3394 buf += chunk; 3387 3395 len -= chunk; 3388 3396 3389 - if ((nbchars < MINLEN) && (len <= 0)) 3390 - goto done; 3397 + if (out->writecallback) { 3398 + if ((nbchars < MINLEN) && (len <= 0)) 3399 + goto done; 3391 3400 3392 - if (out->writecallback) { 3393 3401 /* 3394 3402 * second write the stuff to the I/O channel 3395 3403 */ ··· 3409 3417 out->error = XML_IO_WRITE; 3410 3418 return(ret); 3411 3419 } 3412 - out->written += ret; 3420 + if (out->written > INT_MAX - ret) 3421 + out->written = INT_MAX; 3422 + else 3423 + out->written += ret; 3413 3424 } 3414 3425 written += nbchars; 3415 3426 } while (len > 0); ··· 3489 3500 * @escaping: an optional escaping function (or NULL) 3490 3501 * 3491 3502 * Write the content of the string in the output I/O buffer 3492 - * This routine escapes the caracters and then handle the I18N 3503 + * This routine escapes the characters and then handle the I18N 3493 3504 * transcoding from internal UTF-8 3494 3505 * The buffer is lossless, i.e. will store in case of partial 3495 3506 * or delayed writes. ··· 3565 3576 out->error = XML_IO_ENCODER; 3566 3577 return(-1); 3567 3578 } 3568 - nbchars = xmlBufUse(out->conv); 3579 + if (out->writecallback) 3580 + nbchars = xmlBufUse(out->conv); 3581 + else 3582 + nbchars = ret; 3569 3583 } else { 3570 3584 ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons); 3571 3585 if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */ 3572 3586 return(-1); 3573 3587 xmlBufAddLen(out->buffer, chunk); 3574 - nbchars = xmlBufUse(out->buffer); 3588 + if (out->writecallback) 3589 + nbchars = xmlBufUse(out->buffer); 3590 + else 3591 + nbchars = chunk; 3575 3592 } 3576 3593 str += cons; 3577 3594 len -= cons; 3578 3595 3579 - if ((nbchars < MINLEN) && (len <= 0)) 3580 - goto done; 3596 + if (out->writecallback) { 3597 + if ((nbchars < MINLEN) && (len <= 0)) 3598 + goto done; 3581 3599 3582 - if (out->writecallback) { 3583 3600 /* 3584 3601 * second write the stuff to the I/O channel 3585 3602 */ ··· 3599 3616 out->error = XML_IO_WRITE; 3600 3617 return(ret); 3601 3618 } 3602 - out->written += ret; 3619 + if (out->written > INT_MAX - ret) 3620 + out->written = INT_MAX; 3621 + else 3622 + out->written += ret; 3603 3623 } else if (xmlBufAvail(out->buffer) < MINLEN) { 3604 3624 xmlBufGrow(out->buffer, MINLEN); 3605 3625 } ··· 3693 3713 out->error = XML_IO_FLUSH; 3694 3714 return(ret); 3695 3715 } 3696 - out->written += ret; 3716 + if (out->written > INT_MAX - ret) 3717 + out->written = INT_MAX; 3718 + else 3719 + out->written += ret; 3697 3720 3698 3721 #ifdef DEBUG_INPUT 3699 3722 xmlGenericError(xmlGenericErrorContext, ··· 3941 3964 * @ID: the System ID for the entity to load 3942 3965 * @ctxt: the context in which the entity is called or NULL 3943 3966 * 3944 - * By default we don't load external entitites, yet. 3967 + * By default we don't load external entities, yet. 3945 3968 * 3946 3969 * Returns a new allocated xmlParserInputPtr, or NULL. 3947 3970 */
+35 -57
sdk/lib/3rdparty/libxml2/xmllint.c
··· 180 180 #ifdef LIBXML_READER_ENABLED 181 181 static int stream = 0; 182 182 static int walker = 0; 183 + #ifdef LIBXML_PATTERN_ENABLED 184 + static const char *pattern = NULL; 185 + static xmlPatternPtr patternc = NULL; 186 + static xmlStreamCtxtPtr patstream = NULL; 187 + #endif 183 188 #endif /* LIBXML_READER_ENABLED */ 184 189 static int chkregister = 0; 185 190 static int nbregister = 0; 186 191 #ifdef LIBXML_SAX1_ENABLED 187 192 static int sax1 = 0; 188 193 #endif /* LIBXML_SAX1_ENABLED */ 189 - #ifdef LIBXML_PATTERN_ENABLED 190 - static const char *pattern = NULL; 191 - static xmlPatternPtr patternc = NULL; 192 - static xmlStreamCtxtPtr patstream = NULL; 193 - #endif 194 194 #ifdef LIBXML_XPATH_ENABLED 195 195 static const char *xpathquery = NULL; 196 196 #endif ··· 519 519 #endif 520 520 /************************************************************************ 521 521 * * 522 - * HTML ouput * 522 + * HTML output * 523 523 * * 524 524 ************************************************************************/ 525 525 static char buffer[50000]; ··· 1652 1652 xmlSchemaValidCtxtPtr vctxt; 1653 1653 1654 1654 vctxt = xmlSchemaNewValidCtxt(wxschemas); 1655 - xmlSchemaSetValidErrors(vctxt, 1656 - (xmlSchemaValidityErrorFunc) fprintf, 1657 - (xmlSchemaValidityWarningFunc) fprintf, 1658 - stderr); 1655 + xmlSchemaSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL); 1659 1656 xmlSchemaValidateSetFilename(vctxt, filename); 1660 1657 1661 1658 ret = xmlSchemaValidateStream(vctxt, buf, 0, handler, ··· 2086 2083 } 2087 2084 for (i = 0;i < cur->nodesetval->nodeNr;i++) { 2088 2085 node = cur->nodesetval->nodeTab[i]; 2089 - xmlNodeDumpOutput(buf, node->doc, node, 0, 0, NULL); 2086 + xmlNodeDumpOutput(buf, NULL, node, 0, 0, NULL); 2090 2087 xmlOutputBufferWrite(buf, 1, "\n"); 2091 2088 } 2092 2089 xmlOutputBufferClose(buf); ··· 2760 2757 "Couldn't allocate validation context\n"); 2761 2758 exit(-1); 2762 2759 } 2763 - cvp->userData = (void *) stderr; 2764 - cvp->error = (xmlValidityErrorFunc) fprintf; 2765 - cvp->warning = (xmlValidityWarningFunc) fprintf; 2760 + cvp->userData = NULL; 2761 + cvp->error = xmlGenericError; 2762 + cvp->warning = xmlGenericError; 2766 2763 2767 2764 if ((timing) && (!repeat)) { 2768 2765 startTimer(); ··· 2796 2793 if ((timing) && (!repeat)) { 2797 2794 startTimer(); 2798 2795 } 2799 - cvp->userData = (void *) stderr; 2800 - cvp->error = (xmlValidityErrorFunc) fprintf; 2801 - cvp->warning = (xmlValidityWarningFunc) fprintf; 2796 + cvp->userData = NULL; 2797 + cvp->error = xmlGenericError; 2798 + cvp->warning = xmlGenericError; 2802 2799 if (!xmlValidateDocument(cvp, doc)) { 2803 2800 xmlGenericError(xmlGenericErrorContext, 2804 2801 "Document %s does not validate\n", filename); ··· 2828 2825 flag |= XML_SCHEMATRON_OUT_QUIET; 2829 2826 ctxt = xmlSchematronNewValidCtxt(wxschematron, flag); 2830 2827 #if 0 2831 - xmlSchematronSetValidErrors(ctxt, 2832 - (xmlSchematronValidityErrorFunc) fprintf, 2833 - (xmlSchematronValidityWarningFunc) fprintf, 2834 - stderr); 2828 + xmlSchematronSetValidErrors(ctxt, xmlGenericError, xmlGenericError, 2829 + NULL); 2835 2830 #endif 2836 2831 ret = xmlSchematronValidateDoc(ctxt, doc); 2837 2832 if (ret == 0) { ··· 2860 2855 } 2861 2856 2862 2857 ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas); 2863 - xmlRelaxNGSetValidErrors(ctxt, 2864 - (xmlRelaxNGValidityErrorFunc) fprintf, 2865 - (xmlRelaxNGValidityWarningFunc) fprintf, 2866 - stderr); 2858 + xmlRelaxNGSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL); 2867 2859 ret = xmlRelaxNGValidateDoc(ctxt, doc); 2868 2860 if (ret == 0) { 2869 2861 fprintf(stderr, "%s validates\n", filename); ··· 2888 2880 } 2889 2881 2890 2882 ctxt = xmlSchemaNewValidCtxt(wxschemas); 2891 - xmlSchemaSetValidErrors(ctxt, 2892 - (xmlSchemaValidityErrorFunc) fprintf, 2893 - (xmlSchemaValidityWarningFunc) fprintf, 2894 - stderr); 2883 + xmlSchemaSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL); 2895 2884 ret = xmlSchemaValidateDoc(ctxt, doc); 2896 2885 if (ret == 0) { 2897 2886 fprintf(stderr, "%s validates\n", filename); ··· 3069 3058 #ifdef LIBXML_READER_ENABLED 3070 3059 fprintf(f, "\t--stream : use the streaming interface to process very large files\n"); 3071 3060 fprintf(f, "\t--walker : create a reader and walk though the resulting doc\n"); 3072 - #endif /* LIBXML_READER_ENABLED */ 3073 3061 #ifdef LIBXML_PATTERN_ENABLED 3074 3062 fprintf(f, "\t--pattern pattern_value : test the pattern support\n"); 3075 3063 #endif 3064 + #endif /* LIBXML_READER_ENABLED */ 3076 3065 fprintf(f, "\t--chkregister : verify the node registration code\n"); 3077 3066 #ifdef LIBXML_SCHEMAS_ENABLED 3078 3067 fprintf(f, "\t--relaxng schema : do RelaxNG validation against the schema\n"); ··· 3404 3393 (!strcmp(argv[i], "--walker"))) { 3405 3394 walker++; 3406 3395 noout++; 3396 + #ifdef LIBXML_PATTERN_ENABLED 3397 + } else if ((!strcmp(argv[i], "-pattern")) || 3398 + (!strcmp(argv[i], "--pattern"))) { 3399 + i++; 3400 + pattern = argv[i]; 3401 + #endif 3407 3402 } 3408 3403 #endif /* LIBXML_READER_ENABLED */ 3409 3404 #ifdef LIBXML_SAX1_ENABLED ··· 3454 3449 (!strcmp(argv[i], "--path"))) { 3455 3450 i++; 3456 3451 parsePath(BAD_CAST argv[i]); 3457 - #ifdef LIBXML_PATTERN_ENABLED 3458 - } else if ((!strcmp(argv[i], "-pattern")) || 3459 - (!strcmp(argv[i], "--pattern"))) { 3460 - i++; 3461 - pattern = argv[i]; 3462 - #endif 3463 3452 #ifdef LIBXML_XPATH_ENABLED 3464 3453 } else if ((!strcmp(argv[i], "-xpath")) || 3465 3454 (!strcmp(argv[i], "--xpath"))) { ··· 3552 3541 } 3553 3542 ctxt = xmlSchematronNewParserCtxt(schematron); 3554 3543 #if 0 3555 - xmlSchematronSetParserErrors(ctxt, 3556 - (xmlSchematronValidityErrorFunc) fprintf, 3557 - (xmlSchematronValidityWarningFunc) fprintf, 3558 - stderr); 3544 + xmlSchematronSetParserErrors(ctxt, xmlGenericError, xmlGenericError, 3545 + NULL); 3559 3546 #endif 3560 3547 wxschematron = xmlSchematronParse(ctxt); 3561 3548 if (wxschematron == NULL) { ··· 3585 3572 startTimer(); 3586 3573 } 3587 3574 ctxt = xmlRelaxNGNewParserCtxt(relaxng); 3588 - xmlRelaxNGSetParserErrors(ctxt, 3589 - (xmlRelaxNGValidityErrorFunc) fprintf, 3590 - (xmlRelaxNGValidityWarningFunc) fprintf, 3591 - stderr); 3575 + xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError, 3576 + NULL); 3592 3577 relaxngschemas = xmlRelaxNGParse(ctxt); 3593 3578 if (relaxngschemas == NULL) { 3594 3579 xmlGenericError(xmlGenericErrorContext, ··· 3611 3596 startTimer(); 3612 3597 } 3613 3598 ctxt = xmlSchemaNewParserCtxt(schema); 3614 - xmlSchemaSetParserErrors(ctxt, 3615 - (xmlSchemaValidityErrorFunc) fprintf, 3616 - (xmlSchemaValidityWarningFunc) fprintf, 3617 - stderr); 3599 + xmlSchemaSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL); 3618 3600 wxschemas = xmlSchemaParse(ctxt); 3619 3601 if (wxschemas == NULL) { 3620 3602 xmlGenericError(xmlGenericErrorContext, ··· 3628 3610 } 3629 3611 } 3630 3612 #endif /* LIBXML_SCHEMAS_ENABLED */ 3631 - #ifdef LIBXML_PATTERN_ENABLED 3632 - if ((pattern != NULL) 3633 - #ifdef LIBXML_READER_ENABLED 3634 - && (walker == 0) 3635 - #endif 3636 - ) { 3613 + #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) 3614 + if ((pattern != NULL) && (walker == 0)) { 3637 3615 patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL); 3638 3616 if (patternc == NULL) { 3639 3617 xmlGenericError(xmlGenericErrorContext, ··· 3642 3620 pattern = NULL; 3643 3621 } 3644 3622 } 3645 - #endif /* LIBXML_PATTERN_ENABLED */ 3623 + #endif /* LIBXML_READER_ENABLED && LIBXML_PATTERN_ENABLED */ 3646 3624 for (i = 1; i < argc ; i++) { 3647 3625 if ((!strcmp(argv[i], "-encode")) || 3648 3626 (!strcmp(argv[i], "--encode"))) { ··· 3696 3674 i++; 3697 3675 continue; 3698 3676 } 3699 - #ifdef LIBXML_PATTERN_ENABLED 3677 + #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) 3700 3678 if ((!strcmp(argv[i], "-pattern")) || 3701 3679 (!strcmp(argv[i], "--pattern"))) { 3702 3680 i++; ··· 3780 3758 xmlSchemaFree(wxschemas); 3781 3759 xmlRelaxNGCleanupTypes(); 3782 3760 #endif 3783 - #ifdef LIBXML_PATTERN_ENABLED 3761 + #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) 3784 3762 if (patternc != NULL) 3785 3763 xmlFreePattern(patternc); 3786 3764 #endif
+2 -2
sdk/lib/3rdparty/libxml2/xmlmodule.c
··· 67 67 * 68 68 * Opens a module/shared library given its name or path 69 69 * NOTE: that due to portability issues, behaviour can only be 70 - * guaranteed with @name using ASCII. We canot guarantee that 70 + * guaranteed with @name using ASCII. We cannot guarantee that 71 71 * an UTF-8 string would work, which is why name is a const char * 72 72 * and not a const xmlChar * . 73 73 * TODO: options are not yet implemented. ··· 109 109 * 110 110 * Lookup for a symbol address in the given module 111 111 * NOTE: that due to portability issues, behaviour can only be 112 - * guaranteed with @name using ASCII. We canot guarantee that 112 + * guaranteed with @name using ASCII. We cannot guarantee that 113 113 * an UTF-8 string would work, which is why name is a const char * 114 114 * and not a const xmlChar * . 115 115 *
+54 -33
sdk/lib/3rdparty/libxml2/xmlreader.c
··· 238 238 239 239 if (id->value != NULL) 240 240 DICT_FREE(id->value) 241 + if (id->name != NULL) 242 + DICT_FREE(id->name) 241 243 xmlFree(id); 242 244 } 243 245 ··· 271 273 return(-1); 272 274 } 273 275 id->name = attr->name; 276 + attr->name = NULL; 274 277 id->attr = NULL; 275 278 return(0); 276 279 } ··· 345 348 static void 346 349 xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) { 347 350 xmlNodePtr next; 351 + xmlNodePtr parent; 348 352 xmlDictPtr dict; 353 + size_t depth = 0; 349 354 350 355 if ((reader != NULL) && (reader->ctxt != NULL)) 351 356 dict = reader->ctxt->dict; ··· 361 366 xmlFreeDoc((xmlDocPtr) cur); 362 367 return; 363 368 } 364 - while (cur != NULL) { 369 + while (1) { 370 + while ((cur->type != XML_DTD_NODE) && 371 + (cur->type != XML_ENTITY_REF_NODE) && 372 + (cur->children != NULL) && 373 + (cur->children->parent == cur)) { 374 + cur = cur->children; 375 + depth += 1; 376 + } 377 + 365 378 next = cur->next; 379 + parent = cur->parent; 380 + 366 381 /* unroll to speed up freeing the document */ 367 382 if (cur->type != XML_DTD_NODE) { 368 383 369 - if ((cur->children != NULL) && 370 - (cur->type != XML_ENTITY_REF_NODE)) { 371 - if (cur->children->parent == cur) 372 - xmlTextReaderFreeNodeList(reader, cur->children); 373 - cur->children = NULL; 374 - } 375 - 376 384 if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) 377 385 xmlDeregisterNodeDefaultValue(cur); 378 386 ··· 411 419 xmlFree(cur); 412 420 } 413 421 } 414 - cur = next; 422 + 423 + if (next != NULL) { 424 + cur = next; 425 + } else { 426 + if ((depth == 0) || (parent == NULL)) 427 + break; 428 + depth -= 1; 429 + cur = parent; 430 + cur->children = NULL; 431 + } 415 432 } 416 433 } 417 434 ··· 983 1000 */ 984 1001 node = xmlTextReaderExpand(reader); 985 1002 if (node == NULL) { 986 - printf("Expand failed !\n"); 987 1003 ret = -1; 988 1004 } else { 989 1005 ret = xmlRelaxNGValidateFullElement(reader->rngValidCtxt, ··· 1095 1111 do { 1096 1112 if (node->type == XML_ENTITY_REF_NODE) { 1097 1113 /* 1098 - * Case where the underlying tree is not availble, lookup the entity 1114 + * Case where the underlying tree is not available, lookup the entity 1099 1115 * and walk it. 1100 1116 */ 1101 1117 if ((node->children == NULL) && (ctxt->sax != NULL) && ··· 1112 1128 continue; 1113 1129 } else { 1114 1130 /* 1115 - * The error has probably be raised already. 1131 + * The error has probably been raised already. 1116 1132 */ 1117 1133 if (node == oldnode) 1118 1134 break; 1119 - node = node->next; 1135 + goto skip_children; 1120 1136 } 1121 1137 #ifdef LIBXML_REGEXP_ENABLED 1122 1138 } else if (node->type == XML_ELEMENT_NODE) { ··· 1138 1154 } else if (node->type == XML_ELEMENT_NODE) { 1139 1155 xmlTextReaderValidatePop(reader); 1140 1156 } 1157 + skip_children: 1141 1158 if (node->next != NULL) { 1142 1159 node = node->next; 1143 1160 continue; ··· 1357 1374 1358 1375 /* 1359 1376 * If we are not backtracking on ancestors or examined nodes, 1360 - * that the parser didn't finished or that we arent at the end 1377 + * that the parser didn't finished or that we aren't at the end 1361 1378 * of stream, continue processing. 1362 1379 */ 1363 1380 while ((reader->node != NULL) && (reader->node->next == NULL) && ··· 1548 1565 (reader->node->type == XML_ENTITY_REF_NODE) && 1549 1566 (reader->ctxt != NULL) && (reader->ctxt->replaceEntities == 1)) { 1550 1567 /* 1551 - * Case where the underlying tree is not availble, lookup the entity 1568 + * Case where the underlying tree is not available, lookup the entity 1552 1569 * and walk it. 1553 1570 */ 1554 1571 if ((reader->node->children == NULL) && (reader->ctxt->sax != NULL) && ··· 1713 1730 } 1714 1731 doc = reader->node->doc; 1715 1732 buff = xmlBufferCreate(); 1733 + if (buff == NULL) 1734 + return NULL; 1716 1735 for (cur_node = reader->node->children; cur_node != NULL; 1717 1736 cur_node = cur_node->next) { 1718 1737 /* XXX: Why is the node copied? */ ··· 1755 1774 xmlBufferPtr buff; 1756 1775 xmlDocPtr doc; 1757 1776 1758 - node = reader->node; 1759 - doc = node->doc; 1760 1777 if (xmlTextReaderExpand(reader) == NULL) { 1761 1778 return NULL; 1762 1779 } 1780 + node = reader->node; 1781 + doc = node->doc; 1763 1782 /* XXX: Why is the node copied? */ 1764 1783 if (node->type == XML_DTD_NODE) { 1765 1784 node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node); ··· 2262 2281 if (reader->ctxt != NULL) { 2263 2282 if (reader->dict == reader->ctxt->dict) 2264 2283 reader->dict = NULL; 2265 - if (reader->ctxt->myDoc != NULL) { 2266 - if (reader->preserve == 0) 2267 - xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); 2268 - reader->ctxt->myDoc = NULL; 2269 - } 2270 2284 if ((reader->ctxt->vctxt.vstateTab != NULL) && 2271 2285 (reader->ctxt->vctxt.vstateMax > 0)){ 2286 + while (reader->ctxt->vctxt.vstateNr > 0) 2287 + xmlValidatePopElement(&reader->ctxt->vctxt, NULL, NULL, NULL); 2272 2288 xmlFree(reader->ctxt->vctxt.vstateTab); 2273 2289 reader->ctxt->vctxt.vstateTab = NULL; 2274 2290 reader->ctxt->vctxt.vstateMax = 0; 2291 + } 2292 + if (reader->ctxt->myDoc != NULL) { 2293 + if (reader->preserve == 0) 2294 + xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); 2295 + reader->ctxt->myDoc = NULL; 2275 2296 } 2276 2297 if (reader->allocs & XML_TEXTREADER_CTXT) 2277 2298 xmlFreeParserCtxt(reader->ctxt); ··· 2500 2521 * parser, set its state to End Of File and return the input stream with 2501 2522 * what is left that the parser did not use. 2502 2523 * 2503 - * The implementation is not good, the parser certainly procgressed past 2524 + * The implementation is not good, the parser certainly progressed past 2504 2525 * what's left in reader->input, and there is an allocation problem. Best 2505 2526 * would be to rewrite it differently. 2506 2527 * ··· 2882 2903 * 2883 2904 * Parses an attribute value into one or more Text and EntityReference nodes. 2884 2905 * 2885 - * Returns 1 in case of success, 0 if the reader was not positionned on an 2886 - * ttribute node or all the attribute values have been read, or -1 2906 + * Returns 1 in case of success, 0 if the reader was not positioned on an 2907 + * attribute node or all the attribute values have been read, or -1 2887 2908 * in case of error. 2888 2909 */ 2889 2910 int ··· 3920 3941 * xmlTextReaderCurrentNode: 3921 3942 * @reader: the xmlTextReaderPtr used 3922 3943 * 3923 - * Hacking interface allowing to get the xmlNodePtr correponding to the 3944 + * Hacking interface allowing to get the xmlNodePtr corresponding to the 3924 3945 * current node being accessed by the xmlTextReader. This is dangerous 3925 3946 * because the underlying node may be destroyed on the next Reads. 3926 3947 * ··· 4032 4053 * xmlTextReaderCurrentDoc: 4033 4054 * @reader: the xmlTextReaderPtr used 4034 4055 * 4035 - * Hacking interface allowing to get the xmlDocPtr correponding to the 4056 + * Hacking interface allowing to get the xmlDocPtr corresponding to the 4036 4057 * current document being accessed by the xmlTextReader. 4037 4058 * NOTE: as a result of this call, the reader will not destroy the 4038 4059 * associated XML document and calling xmlFreeDoc() on the result ··· 4135 4156 * 4136 4157 * Use RelaxNG to validate the document as it is processed. 4137 4158 * Activation is only possible before the first Read(). 4138 - * if @schema is NULL, then RelaxNG validation is desactivated. 4159 + * if @schema is NULL, then RelaxNG validation is deactivated. 4139 4160 @ The @schema should not be freed until the reader is deallocated 4140 4161 * or its use has been deactivated. 4141 4162 * 4142 - * Returns 0 in case the RelaxNG validation could be (des)activated and 4163 + * Returns 0 in case the RelaxNG validation could be (de)activated and 4143 4164 * -1 in case of error. 4144 4165 */ 4145 4166 int ··· 4199 4220 * 4200 4221 * Internal locator function for the readers 4201 4222 * 4202 - * Returns 0 in case the Schema validation could be (des)activated and 4223 + * Returns 0 in case the Schema validation could be (de)activated and 4203 4224 * -1 in case of error. 4204 4225 */ 4205 4226 static int ··· 4252 4273 * 4253 4274 * Use XSD Schema to validate the document as it is processed. 4254 4275 * Activation is only possible before the first Read(). 4255 - * if @schema is NULL, then Schema validation is desactivated. 4256 - @ The @schema should not be freed until the reader is deallocated 4276 + * if @schema is NULL, then Schema validation is deactivated. 4277 + * The @schema should not be freed until the reader is deallocated 4257 4278 * or its use has been deactivated. 4258 4279 * 4259 - * Returns 0 in case the Schema validation could be (des)activated and 4280 + * Returns 0 in case the Schema validation could be (de)activated and 4260 4281 * -1 in case of error. 4261 4282 */ 4262 4283 int
+56 -43
sdk/lib/3rdparty/libxml2/xmlregexp.c
··· 2 2 * regexp.c: generic and extensible Regular Expression engine 3 3 * 4 4 * Basically designed with the purpose of compiling regexps for 5 - * the variety of validation/shemas mechanisms now available in 5 + * the variety of validation/schemas mechanisms now available in 6 6 * XML related specifications these include: 7 7 * - XML-1.0 DTD validation 8 8 * - XML Schemas structure part 1 ··· 228 228 int maxTrans; 229 229 int nbTrans; 230 230 xmlRegTrans *trans; 231 - /* knowing states ponting to us can speed things up */ 231 + /* knowing states pointing to us can speed things up */ 232 232 int maxTransTo; 233 233 int nbTransTo; 234 234 int *transTo; ··· 545 545 if (transitions == NULL) { 546 546 xmlFree(stateRemap); 547 547 xmlFree(stringRemap); 548 + for (i = 0;i < nbatoms;i++) 549 + xmlFree(stringMap[i]); 548 550 xmlFree(stringMap); 549 551 xmlFree(ret); 550 552 return(NULL); ··· 588 590 targetno = stateRemap[trans->to]; 589 591 /* 590 592 * if the same atom can generate transitions to 2 different 591 - * states then it means the automata is not determinist and 593 + * states then it means the automata is not deterministic and 592 594 * the compact form can't be used ! 593 595 */ 594 596 prev = transitions[stateno * (nbatoms + 1) + atomno + 1]; ··· 829 831 /** 830 832 * xmlRegCopyAtom: 831 833 * @ctxt: the regexp parser context 832 - * @atom: the oiginal atom 834 + * @atom: the original atom 833 835 * 834 836 * Allocate a new regexp range 835 837 * ··· 1547 1549 int nullable = 0; 1548 1550 1549 1551 if (atom == NULL) { 1550 - ERROR("genrate transition: atom == NULL"); 1552 + ERROR("generate transition: atom == NULL"); 1551 1553 return(-1); 1552 1554 } 1553 1555 if (atom->type == XML_REGEXP_SUBREG) { ··· 1622 1624 xmlRegAtomPtr copy; 1623 1625 /* 1624 1626 * duplicate a transition based on atom to count next 1625 - * occurences after 1. We cannot loop to atom->start 1627 + * occurrences after 1. We cannot loop to atom->start 1626 1628 * directly because we need an epsilon transition to 1627 1629 * newstate. 1628 1630 */ ··· 1655 1657 } else { 1656 1658 /* 1657 1659 * either we need the atom at least once or there 1658 - * is an atom->start0 allowing to easilly plug the 1660 + * is an atom->start0 allowing to easily plug the 1659 1661 * epsilon transition. 1660 1662 */ 1661 1663 counter = xmlRegGetCounter(ctxt); ··· 1955 1957 * Build the completed transitions bypassing the epsilons 1956 1958 * Use a marking algorithm to avoid loops 1957 1959 * Mark sink states too. 1958 - * Process from the latests states backward to the start when 1960 + * Process from the latest states backward to the start when 1959 1961 * there is long cascading epsilon chains this minimize the 1960 1962 * recursions and transition compares when adding the new ones 1961 1963 */ ··· 2143 2145 } else { 2144 2146 /* 2145 2147 * comparing a block range with anything else is way 2146 - * too costly, and maintining the table is like too much 2148 + * too costly, and maintaining the table is like too much 2147 2149 * memory too, so let's force the automata to save state 2148 2150 * here. 2149 2151 */ ··· 2277 2279 } 2278 2280 switch (type1) { 2279 2281 case XML_REGEXP_ANYSPACE: /* \s */ 2280 - /* can't be a letter, number, mark, pontuation, symbol */ 2282 + /* can't be a letter, number, mark, punctuation, symbol */ 2281 2283 if ((type2 == XML_REGEXP_NOTSPACE) || 2282 2284 ((type2 >= XML_REGEXP_LETTER) && 2283 2285 (type2 <= XML_REGEXP_LETTER_OTHERS)) || ··· 2294 2296 case XML_REGEXP_NOTSPACE: /* \S */ 2295 2297 break; 2296 2298 case XML_REGEXP_INITNAME: /* \l */ 2297 - /* can't be a number, mark, separator, pontuation, symbol or other */ 2299 + /* can't be a number, mark, separator, punctuation, symbol or other */ 2298 2300 if ((type2 == XML_REGEXP_NOTINITNAME) || 2299 2301 ((type2 >= XML_REGEXP_NUMBER) && 2300 2302 (type2 <= XML_REGEXP_NUMBER_OTHERS)) || ··· 2313 2315 case XML_REGEXP_NOTINITNAME: /* \L */ 2314 2316 break; 2315 2317 case XML_REGEXP_NAMECHAR: /* \c */ 2316 - /* can't be a mark, separator, pontuation, symbol or other */ 2318 + /* can't be a mark, separator, punctuation, symbol or other */ 2317 2319 if ((type2 == XML_REGEXP_NOTNAMECHAR) || 2318 2320 ((type2 >= XML_REGEXP_MARK) && 2319 2321 (type2 <= XML_REGEXP_MARK_ENCLOSING)) || ··· 2330 2332 case XML_REGEXP_NOTNAMECHAR: /* \C */ 2331 2333 break; 2332 2334 case XML_REGEXP_DECIMAL: /* \d */ 2333 - /* can't be a letter, mark, separator, pontuation, symbol or other */ 2335 + /* can't be a letter, mark, separator, punctuation, symbol or other */ 2334 2336 if ((type2 == XML_REGEXP_NOTDECIMAL) || 2335 2337 (type2 == XML_REGEXP_REALCHAR) || 2336 2338 ((type2 >= XML_REGEXP_LETTER) && ··· 2350 2352 case XML_REGEXP_NOTDECIMAL: /* \D */ 2351 2353 break; 2352 2354 case XML_REGEXP_REALCHAR: /* \w */ 2353 - /* can't be a mark, separator, pontuation, symbol or other */ 2355 + /* can't be a mark, separator, punctuation, symbol or other */ 2354 2356 if ((type2 == XML_REGEXP_NOTDECIMAL) || 2355 2357 ((type2 >= XML_REGEXP_MARK) && 2356 2358 (type2 <= XML_REGEXP_MARK_ENCLOSING)) || ··· 2526 2528 case XML_REGEXP_STRING: 2527 2529 if (!deep) 2528 2530 ret = (atom1->valuep != atom2->valuep); 2529 - else 2530 - ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep, 2531 - (xmlChar *)atom2->valuep); 2531 + else { 2532 + xmlChar *val1 = (xmlChar *)atom1->valuep; 2533 + xmlChar *val2 = (xmlChar *)atom2->valuep; 2534 + int compound1 = (xmlStrchr(val1, '|') != NULL); 2535 + int compound2 = (xmlStrchr(val2, '|') != NULL); 2536 + 2537 + /* Ignore negative match flag for ##other namespaces */ 2538 + if (compound1 != compound2) 2539 + return(0); 2540 + 2541 + ret = xmlRegStrEqualWildcard(val1, val2); 2542 + } 2532 2543 break; 2533 2544 case XML_REGEXP_EPSILON: 2534 2545 goto not_determinist; ··· 3564 3575 3565 3576 /** 3566 3577 * xmlRegFreeExecCtxt: 3567 - * @exec: a regular expression evaulation context 3578 + * @exec: a regular expression evaluation context 3568 3579 * 3569 - * Free the structures associated to a regular expression evaulation context. 3580 + * Free the structures associated to a regular expression evaluation context. 3570 3581 */ 3571 3582 void 3572 3583 xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) { ··· 3640 3651 * @valStr: the validation string 3641 3652 * 3642 3653 * Checks if both strings are equal or have the same content. "*" 3643 - * can be used as a wildcard in @valStr; "|" is used as a seperator of 3654 + * can be used as a wildcard in @valStr; "|" is used as a separator of 3644 3655 * substrings in both @expStr and @valStr. 3645 3656 * 3646 3657 * Returns 1 if the comparison is satisfied and the number of substrings ··· 5347 5358 5348 5359 previous = ctxt->state; 5349 5360 ret = xmlFAParsePiece(ctxt); 5350 - if (ret != 0) { 5361 + if (ret == 0) { 5362 + /* Empty branch */ 5363 + xmlFAGenerateEpsilonTransition(ctxt, previous, to); 5364 + } else { 5351 5365 if (xmlFAGenerateTransitions(ctxt, previous, 5352 - (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) 5366 + (CUR=='|' || CUR==')' || CUR==0) ? to : NULL, ctxt->atom) < 0) 5353 5367 return(-1); 5354 5368 previous = ctxt->state; 5355 5369 ctxt->atom = NULL; ··· 5358 5372 ret = xmlFAParsePiece(ctxt); 5359 5373 if (ret != 0) { 5360 5374 if (xmlFAGenerateTransitions(ctxt, previous, 5361 - (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) 5375 + (CUR=='|' || CUR==')' || CUR==0) ? to : NULL, 5376 + ctxt->atom) < 0) 5362 5377 return(-1); 5363 5378 previous = ctxt->state; 5364 5379 ctxt->atom = NULL; ··· 5395 5410 end = ctxt->state; 5396 5411 while ((CUR == '|') && (ctxt->error == 0)) { 5397 5412 NEXT; 5398 - if (CUR == 0) { 5399 - ERROR("expecting a branch after |") 5400 - return; 5401 - } 5402 5413 ctxt->state = start; 5403 5414 ctxt->end = NULL; 5404 5415 xmlFAParseBranch(ctxt, end); ··· 5537 5548 return(comp->determinist); 5538 5549 5539 5550 am = xmlNewAutomata(); 5551 + if (am == NULL) 5552 + return(-1); 5540 5553 if (am->states != NULL) { 5541 5554 int i; 5542 5555 ··· 5864 5877 * @to: the target point of the transition or NULL 5865 5878 * @token: the input string associated to that transition 5866 5879 * @token2: the second input string associated to that transition 5867 - * @min: the minimum successive occurences of token 5868 - * @max: the maximum successive occurences of token 5880 + * @min: the minimum successive occurrences of token 5881 + * @max: the maximum successive occurrences of token 5869 5882 * @data: data associated to the transition 5870 5883 * 5871 5884 * If @to is NULL, this creates first a new target state in the automata ··· 5951 5964 * @from: the starting point of the transition 5952 5965 * @to: the target point of the transition or NULL 5953 5966 * @token: the input string associated to that transition 5954 - * @min: the minimum successive occurences of token 5955 - * @max: the maximum successive occurences of token 5967 + * @min: the minimum successive occurrences of token 5968 + * @max: the maximum successive occurrences of token 5956 5969 * @data: data associated to the transition 5957 5970 * 5958 5971 * If @to is NULL, this creates first a new target state in the automata ··· 6018 6031 * @to: the target point of the transition or NULL 6019 6032 * @token: the input string associated to that transition 6020 6033 * @token2: the second input string associated to that transition 6021 - * @min: the minimum successive occurences of token 6022 - * @max: the maximum successive occurences of token 6034 + * @min: the minimum successive occurrences of token 6035 + * @max: the maximum successive occurrences of token 6023 6036 * @data: data associated to the transition 6024 6037 * 6025 6038 * If @to is NULL, this creates first a new target state in the automata ··· 6098 6111 * @from: the starting point of the transition 6099 6112 * @to: the target point of the transition or NULL 6100 6113 * @token: the input string associated to that transition 6101 - * @min: the minimum successive occurences of token 6102 - * @max: the maximum successive occurences of token 6114 + * @min: the minimum successive occurrences of token 6115 + * @max: the maximum successive occurrences of token 6103 6116 * @data: data associated to the transition 6104 6117 * 6105 6118 * If @to is NULL, this creates first a new target state in the automata ··· 6616 6629 /* OR reduction rule 1 */ 6617 6630 /* a | a reduced to a */ 6618 6631 if (left == right) { 6619 - left->ref--; 6632 + xmlExpFree(ctxt, right); 6620 6633 return(left); 6621 6634 } 6622 6635 /* OR canonicalization rule 1 */ ··· 7075 7088 * xmlExpIsNillable: 7076 7089 * @exp: the expression 7077 7090 * 7078 - * Finds if the expression is nillable, i.e. if it accepts the empty sequqnce 7091 + * Finds if the expression is nillable, i.e. if it accepts the empty sequence 7079 7092 * 7080 7093 * Returns 1 if nillable, 0 if not and -1 in case of error 7081 7094 */ ··· 7258 7271 * so that sub{n} subsume exp 7259 7272 * 7260 7273 * Returns the multiple value if successful, 0 if it is not a multiple 7261 - * and -1 in case of internel error. 7274 + * and -1 in case of internal error. 7262 7275 */ 7263 7276 7264 7277 static int ··· 7426 7439 return(forbiddenExp); 7427 7440 } 7428 7441 #ifdef DEBUG_DERIV 7429 - printf("Compex exp vs Atom -> Forbid\n"); 7442 + printf("Complex exp vs Atom -> Forbid\n"); 7430 7443 #endif 7431 7444 return(forbiddenExp); 7432 7445 case XML_EXP_SEQ: ··· 7770 7783 * 7771 7784 * Evaluates the expression resulting from @exp consuming a sub expression @sub 7772 7785 * Based on algebraic derivation and sometimes direct Brzozowski derivation 7773 - * it usually tatkes less than linear time and can handle expressions generating 7786 + * it usually takes less than linear time and can handle expressions generating 7774 7787 * infinite languages. 7775 7788 * 7776 7789 * Returns the resulting expression or NULL in case of internal error, the ··· 7792 7805 } 7793 7806 if (xmlExpCheckCard(exp, sub) == 0) { 7794 7807 #ifdef DEBUG_DERIV 7795 - printf("sub generate longuer sequances than exp : can't subsume\n"); 7808 + printf("sub generate longer sequences than exp : can't subsume\n"); 7796 7809 #endif 7797 7810 return(forbiddenExp); 7798 7811 } ··· 7805 7818 * @exp: the englobing expression 7806 7819 * @sub: the subexpression 7807 7820 * 7808 - * Check whether @exp accepts all the languages accexpted by @sub 7821 + * Check whether @exp accepts all the languages accepted by @sub 7809 7822 * the input being a subexpression. 7810 7823 * 7811 7824 * Returns 1 if true 0 if false and -1 in case of failure. ··· 7832 7845 } 7833 7846 if (xmlExpCheckCard(exp, sub) == 0) { 7834 7847 #ifdef DEBUG_DERIV 7835 - printf("sub generate longuer sequances than exp : can't subsume\n"); 7848 + printf("sub generate longer sequences than exp : can't subsume\n"); 7836 7849 #endif 7837 7850 return(0); 7838 7851 }
+6 -17
sdk/lib/3rdparty/libxml2/xmlsave.c
··· 1 1 /* 2 - * xmlsave.c: Implemetation of the document serializer 2 + * xmlsave.c: Implementation of the document serializer 3 3 * 4 4 * See Copyright for the status of this software. 5 5 * ··· 83 83 const xmlChar *encoding; 84 84 xmlCharEncodingHandlerPtr handler; 85 85 xmlOutputBufferPtr buf; 86 - xmlDocPtr doc; 87 86 int options; 88 87 int level; 89 88 int format; ··· 356 355 /** 357 356 * xmlFreeSaveCtxt: 358 357 * 359 - * Free a saving context, destroying the ouptut in any remaining buffer 358 + * Free a saving context, destroying the output in any remaining buffer 360 359 */ 361 360 static void 362 361 xmlFreeSaveCtxt(xmlSaveCtxtPtr ctxt) ··· 707 706 xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt, xmlDtdPtr dtd) { 708 707 xmlOutputBufferPtr buf; 709 708 int format, level; 710 - xmlDocPtr doc; 711 709 712 710 if (dtd == NULL) return; 713 711 if ((ctxt == NULL) || (ctxt->buf == NULL)) ··· 742 740 } 743 741 format = ctxt->format; 744 742 level = ctxt->level; 745 - doc = ctxt->doc; 746 743 ctxt->format = 0; 747 744 ctxt->level = -1; 748 - ctxt->doc = dtd->doc; 749 745 xmlNodeListDumpOutput(ctxt, dtd->children); 750 746 ctxt->format = format; 751 747 ctxt->level = level; 752 - ctxt->doc = doc; 753 748 xmlOutputBufferWrite(buf, 2, "]>"); 754 749 } 755 750 ··· 2191 2186 * 2192 2187 * Dump an XML node, recursive behaviour,children are printed too. 2193 2188 * Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 2194 - * or xmlKeepBlanksDefault(0) was called 2189 + * or xmlKeepBlanksDefault(0) was called. 2195 2190 * Since this is using xmlBuffer structures it is limited to 2GB and somehow 2196 - * deprecated, use xmlBufNodeDump() instead. 2191 + * deprecated, use xmlNodeDumpOutput() instead. 2197 2192 * 2198 2193 * Returns the number of bytes written to the buffer or -1 in case of error 2199 2194 */ ··· 2360 2355 encoding = "UTF-8"; 2361 2356 2362 2357 memset(&ctxt, 0, sizeof(ctxt)); 2363 - ctxt.doc = doc; 2364 2358 ctxt.buf = buf; 2365 2359 ctxt.level = level; 2366 2360 ctxt.format = format ? 1 : 0; ··· 2446 2440 } 2447 2441 2448 2442 memset(&ctxt, 0, sizeof(ctxt)); 2449 - ctxt.doc = out_doc; 2450 2443 ctxt.buf = out_buff; 2451 2444 ctxt.level = 0; 2452 2445 ctxt.format = format ? 1 : 0; ··· 2565 2558 buf = xmlOutputBufferCreateFile(f, handler); 2566 2559 if (buf == NULL) return(-1); 2567 2560 memset(&ctxt, 0, sizeof(ctxt)); 2568 - ctxt.doc = cur; 2569 2561 ctxt.buf = buf; 2570 2562 ctxt.level = 0; 2571 2563 ctxt.format = format ? 1 : 0; ··· 2596 2588 * xmlSaveFileTo: 2597 2589 * @buf: an output I/O buffer 2598 2590 * @cur: the document 2599 - * @encoding: the encoding if any assuming the I/O layer handles the trancoding 2591 + * @encoding: the encoding if any assuming the I/O layer handles the transcoding 2600 2592 * 2601 2593 * Dump an XML document to an I/O buffer. 2602 2594 * Warning ! This call xmlOutputBufferClose() on buf which is not available ··· 2615 2607 return(-1); 2616 2608 } 2617 2609 memset(&ctxt, 0, sizeof(ctxt)); 2618 - ctxt.doc = cur; 2619 2610 ctxt.buf = buf; 2620 2611 ctxt.level = 0; 2621 2612 ctxt.format = 0; ··· 2631 2622 * xmlSaveFormatFileTo: 2632 2623 * @buf: an output I/O buffer 2633 2624 * @cur: the document 2634 - * @encoding: the encoding if any assuming the I/O layer handles the trancoding 2625 + * @encoding: the encoding if any assuming the I/O layer handles the transcoding 2635 2626 * @format: should formatting spaces been added 2636 2627 * 2637 2628 * Dump an XML document to an I/O buffer. ··· 2655 2646 return(-1); 2656 2647 } 2657 2648 memset(&ctxt, 0, sizeof(ctxt)); 2658 - ctxt.doc = cur; 2659 2649 ctxt.buf = buf; 2660 2650 ctxt.level = 0; 2661 2651 ctxt.format = format ? 1 : 0; ··· 2710 2700 buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression); 2711 2701 if (buf == NULL) return(-1); 2712 2702 memset(&ctxt, 0, sizeof(ctxt)); 2713 - ctxt.doc = cur; 2714 2703 ctxt.buf = buf; 2715 2704 ctxt.level = 0; 2716 2705 ctxt.format = format ? 1 : 0;
+86 -102
sdk/lib/3rdparty/libxml2/xmlschemas.c
··· 22 22 * acquisition episode (xmlSchemaAugmentIDC). 23 23 * 24 24 * NOTES: 25 - * - Elimated item creation for: <restriction>, <extension>, 25 + * - Eliminated item creation for: <restriction>, <extension>, 26 26 * <simpleContent>, <complexContent>, <list>, <union> 27 27 * 28 28 * PROBLEMS: ··· 2780 2780 /** 2781 2781 * xmlSchemaPMissingAttrErr: 2782 2782 * @ctxt: the schema validation context 2783 - * @ownerDes: the designation of the owner 2784 - * @ownerName: the name of the owner 2785 2783 * @ownerItem: the owner as a schema object 2786 2784 * @ownerElem: the owner as an element node 2787 2785 * @node: the parent element node of the missing attribute node ··· 2815 2813 * xmlSchemaPResCompAttrErr: 2816 2814 * @ctxt: the schema validation context 2817 2815 * @error: the error code 2818 - * @ownerDes: the designation of the owner 2819 2816 * @ownerItem: the owner as a schema object 2820 2817 * @ownerElem: the owner as an element node 2821 2818 * @name: the name of the attribute holding the QName ··· 2897 2894 * xmlSchemaPIllegalAttrErr: 2898 2895 * @ctxt: the schema parser context 2899 2896 * @error: the error code 2900 - * @ownerDes: the designation of the attribute's owner 2901 2897 * @ownerItem: the attribute's owner item 2902 2898 * @attr: the illegal attribute node 2903 2899 * ··· 3109 3105 * @ctxt: the schema validation context 3110 3106 * @error: the error code 3111 3107 * @type: the type specifier 3112 - * @ownerDes: the designation of the owner 3113 3108 * @ownerItem: the schema object if existent 3114 3109 * @node: the validated node 3115 3110 * @value: the validated value ··· 3202 3197 * xmlSchemaPContentErr: 3203 3198 * @ctxt: the schema parser context 3204 3199 * @error: the error code 3205 - * @onwerDes: the designation of the holder of the content 3206 3200 * @ownerItem: the owner item of the holder of the content 3207 3201 * @ownerElem: the node of the holder of the content 3208 3202 * @child: the invalid child node ··· 4307 4301 * xmlSchemaContentModelDump: 4308 4302 * @particle: the schema particle 4309 4303 * @output: the file output 4310 - * @depth: the depth used for intentation 4304 + * @depth: the depth used for indentation 4311 4305 * 4312 4306 * Dump a SchemaType structure 4313 4307 */ ··· 5155 5149 * Add an XML schema annotation declaration 5156 5150 * *WARNING* this interface is highly subject to change 5157 5151 * 5158 - * Returns the new struture or NULL in case of error 5152 + * Returns the new structure or NULL in case of error 5159 5153 */ 5160 5154 static xmlSchemaNotationPtr 5161 5155 xmlSchemaAddNotation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ··· 5189 5183 * @name: the item name 5190 5184 * @namespace: the namespace 5191 5185 * 5192 - * Add an XML schema Attrribute declaration 5186 + * Add an XML schema Attribute declaration 5193 5187 * *WARNING* this interface is highly subject to change 5194 5188 * 5195 - * Returns the new struture or NULL in case of error 5189 + * Returns the new structure or NULL in case of error 5196 5190 */ 5197 5191 static xmlSchemaAttributePtr 5198 5192 xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ··· 5230 5224 * @name: the item name 5231 5225 * @namespace: the namespace 5232 5226 * 5233 - * Add an XML schema Attrribute declaration 5227 + * Add an XML schema Attribute declaration 5234 5228 * *WARNING* this interface is highly subject to change 5235 5229 * 5236 - * Returns the new struture or NULL in case of error 5230 + * Returns the new structure or NULL in case of error 5237 5231 */ 5238 5232 static xmlSchemaAttributeUsePtr 5239 5233 xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt, ··· 5301 5295 * @nsName: the target namespace 5302 5296 * @node: the corresponding node 5303 5297 * 5304 - * Add an XML schema Attrribute Group definition. 5298 + * Add an XML schema Attribute Group definition. 5305 5299 * 5306 - * Returns the new struture or NULL in case of error 5300 + * Returns the new structure or NULL in case of error 5307 5301 */ 5308 5302 static xmlSchemaAttributeGroupPtr 5309 5303 xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, ··· 5355 5349 * Add an XML schema Element declaration 5356 5350 * *WARNING* this interface is highly subject to change 5357 5351 * 5358 - * Returns the new struture or NULL in case of error 5352 + * Returns the new structure or NULL in case of error 5359 5353 */ 5360 5354 static xmlSchemaElementPtr 5361 5355 xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, ··· 5396 5390 * Add an XML schema item 5397 5391 * *WARNING* this interface is highly subject to change 5398 5392 * 5399 - * Returns the new struture or NULL in case of error 5393 + * Returns the new structure or NULL in case of error 5400 5394 */ 5401 5395 static xmlSchemaTypePtr 5402 5396 xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ··· 5493 5487 * Adds a schema model group 5494 5488 * *WARNING* this interface is highly subject to change 5495 5489 * 5496 - * Returns the new struture or NULL in case of error 5490 + * Returns the new structure or NULL in case of error 5497 5491 */ 5498 5492 static xmlSchemaModelGroupPtr 5499 5493 xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt, ··· 5535 5529 * Adds an XML schema particle component. 5536 5530 * *WARNING* this interface is highly subject to change 5537 5531 * 5538 - * Returns the new struture or NULL in case of error 5532 + * Returns the new structure or NULL in case of error 5539 5533 */ 5540 5534 static xmlSchemaParticlePtr 5541 5535 xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt, ··· 5581 5575 * 5582 5576 * Add an XML schema Group definition 5583 5577 * 5584 - * Returns the new struture or NULL in case of error 5578 + * Returns the new structure or NULL in case of error 5585 5579 */ 5586 5580 static xmlSchemaModelGroupDefPtr 5587 5581 xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, ··· 5627 5621 * 5628 5622 * Creates a new wildcard namespace constraint. 5629 5623 * 5630 - * Returns the new struture or NULL in case of error 5624 + * Returns the new structure or NULL in case of error 5631 5625 */ 5632 5626 static xmlSchemaWildcardNsPtr 5633 5627 xmlSchemaNewWildcardNsConstraint(xmlSchemaParserCtxtPtr ctxt) ··· 5685 5679 * Adds a wildcard. 5686 5680 * It corresponds to a xsd:anyAttribute and xsd:any. 5687 5681 * 5688 - * Returns the new struture or NULL in case of error 5682 + * Returns the new structure or NULL in case of error 5689 5683 */ 5690 5684 static xmlSchemaWildcardPtr 5691 5685 xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ··· 5813 5807 * xmlSchemaPValAttrNodeQNameValue: 5814 5808 * @ctxt: a schema parser context 5815 5809 * @schema: the schema context 5816 - * @ownerDes: the designation of the parent element 5817 5810 * @ownerItem: the parent as a schema object 5818 5811 * @value: the QName value 5812 + * @uri: the resulting namespace URI if found 5819 5813 * @local: the resulting local part if found, the attribute value otherwise 5820 - * @uri: the resulting namespace URI if found 5821 5814 * 5822 5815 * Extracts the local name and the URI of a QName value and validates it. 5823 5816 * This one is intended to be used on attribute values that ··· 5894 5887 * xmlSchemaPValAttrNodeQName: 5895 5888 * @ctxt: a schema parser context 5896 5889 * @schema: the schema context 5897 - * @ownerDes: the designation of the owner element 5898 5890 * @ownerItem: the owner as a schema object 5899 5891 * @attr: the attribute node 5892 + * @uri: the resulting namespace URI if found 5900 5893 * @local: the resulting local part if found, the attribute value otherwise 5901 - * @uri: the resulting namespace URI if found 5902 5894 * 5903 5895 * Extracts and validates the QName of an attribute value. 5904 5896 * This one is intended to be used on attribute values that ··· 5926 5918 * xmlSchemaPValAttrQName: 5927 5919 * @ctxt: a schema parser context 5928 5920 * @schema: the schema context 5929 - * @ownerDes: the designation of the parent element 5930 5921 * @ownerItem: the owner as a schema object 5931 5922 * @ownerElem: the parent node of the attribute 5932 5923 * @name: the name of the attribute 5933 - * @local: the resulting local part if found, the attribute value otherwise 5934 5924 * @uri: the resulting namespace URI if found 5925 + * @local: the resulting local part if found, the attribute value otherwise 5935 5926 * 5936 5927 * Extracts and validates the QName of an attribute value. 5937 5928 * ··· 5962 5953 /** 5963 5954 * xmlSchemaPValAttrID: 5964 5955 * @ctxt: a schema parser context 5965 - * @schema: the schema context 5966 - * @ownerDes: the designation of the parent element 5967 - * @ownerItem: the owner as a schema object 5968 - * @ownerElem: the parent node of the attribute 5969 - * @name: the name of the attribute 5970 5956 * 5971 5957 * Extracts and validates the ID of an attribute value. 5972 5958 * ··· 6162 6148 /** 6163 6149 * xmlSchemaPGetBoolNodeValue: 6164 6150 * @ctxt: a schema validation context 6165 - * @ownerDes: owner designation 6166 6151 * @ownerItem: the owner as a schema item 6167 6152 * @node: the node holding the value 6168 6153 * ··· 6253 6238 6254 6239 /************************************************************************ 6255 6240 * * 6256 - * Shema extraction from an Infoset * 6241 + * Schema extraction from an Infoset * 6257 6242 * * 6258 6243 ************************************************************************/ 6259 6244 static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ··· 6286 6271 /** 6287 6272 * xmlSchemaPValAttrNodeValue: 6288 6273 * 6289 - * @ctxt: a schema parser context 6290 - * @ownerDes: the designation of the parent element 6274 + * @pctxt: a schema parser context 6291 6275 * @ownerItem: the schema object owner if existent 6292 6276 * @attr: the schema attribute node being validated 6293 6277 * @value: the value ··· 6360 6344 * xmlSchemaPValAttrNode: 6361 6345 * 6362 6346 * @ctxt: a schema parser context 6363 - * @ownerDes: the designation of the parent element 6364 6347 * @ownerItem: the schema object owner if existent 6365 6348 * @attr: the schema attribute node being validated 6366 6349 * @type: the built-in type to be validated against ··· 6398 6381 * 6399 6382 * @ctxt: a schema parser context 6400 6383 * @node: the element node of the attribute 6401 - * @ownerDes: the designation of the parent element 6402 6384 * @ownerItem: the schema object owner if existent 6403 6385 * @ownerElem: the owner element node 6404 6386 * @name: the name of the schema attribute node ··· 6543 6525 * @schema: the schema being built 6544 6526 * @node: a subtree containing XML Schema informations 6545 6527 * 6546 - * parse a XML schema Attrribute declaration 6528 + * parse a XML schema Attribute declaration 6547 6529 * *WARNING* this interface is highly subject to change 6548 6530 * 6549 6531 * Returns -1 in case of error, 0 if the declaration is improper and ··· 6840 6822 dictnsItem = xmlDictLookup(ctxt->dict, nsItem, -1); 6841 6823 } 6842 6824 /* 6843 - * Avoid dublicate namespaces. 6825 + * Avoid duplicate namespaces. 6844 6826 */ 6845 6827 tmp = wildc->nsSet; 6846 6828 while (tmp != NULL) { ··· 7063 7045 * @schema: the schema being built 7064 7046 * @node: a subtree containing XML Schema informations 7065 7047 * 7066 - * parse a XML schema AnyAttrribute declaration 7048 + * parse a XML schema AnyAttribute declaration 7067 7049 * *WARNING* this interface is highly subject to change 7068 7050 * 7069 7051 * Returns a wildcard or NULL. ··· 7133 7115 * @schema: the schema being built 7134 7116 * @node: a subtree containing XML Schema informations 7135 7117 * 7136 - * parse a XML schema Attrribute declaration 7118 + * parse a XML schema Attribute declaration 7137 7119 * *WARNING* this interface is highly subject to change 7138 7120 * 7139 7121 * Returns the attribute declaration. ··· 7953 7935 int ret = 0; 7954 7936 7955 7937 /* 7956 - * TODO: This does not check for dublicate entries. 7938 + * TODO: This does not check for duplicate entries. 7957 7939 */ 7958 7940 if ((flags == NULL) || (value == NULL)) 7959 7941 return (-1); ··· 8145 8127 * 8146 8128 * Adds the annotation to the given schema component. 8147 8129 * 8148 - * Returns the given annotaion. 8130 + * Returns the given annotation. 8149 8131 */ 8150 8132 static xmlSchemaAnnotPtr 8151 8133 xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem, ··· 8240 8222 * @schema: the schema being built 8241 8223 * @node: a subtree containing XML Schema informations 8242 8224 * 8243 - * Parses a XML Schema identity-contraint definition's 8225 + * Parses a XML Schema identity-constraint definition's 8244 8226 * <selector> and <field> elements. 8245 8227 * 8246 8228 * Returns the parsed identity-constraint definition. ··· 8338 8320 * @schema: the schema being built 8339 8321 * @node: a subtree containing XML Schema informations 8340 8322 * 8341 - * Parses a XML Schema identity-contraint definition. 8323 + * Parses a XML Schema identity-constraint definition. 8342 8324 * 8343 8325 * Returns the parsed identity-constraint definition. 8344 8326 */ ··· 9477 9459 * 9478 9460 * Parses a XML schema model group definition. 9479 9461 * 9480 - * Note that the contraint src-redefine (6.2) can't be applied until 9462 + * Note that the constraint src-redefine (6.2) can't be applied until 9481 9463 * references have been resolved. So we will do this at the 9482 9464 * component fixup level. 9483 9465 * ··· 10185 10167 goto exit; 10186 10168 /* 10187 10169 * TODO: Not nice, but I'm not 100% sure we will get always an error 10188 - * as a result of the obove functions; so better rely on pctxt->err 10170 + * as a result of the above functions; so better rely on pctxt->err 10189 10171 * as well. 10190 10172 */ 10191 10173 if ((ret == 0) && (oldErrs != pctxt->nberrors)) { ··· 10279 10261 xmlNodePtr ctxtNode) 10280 10262 { 10281 10263 /* 10282 - * Build an absolue location URI. 10264 + * Build an absolute location URI. 10283 10265 */ 10284 10266 if (location != NULL) { 10285 10267 if (ctxtNode == NULL) ··· 10361 10343 if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt))) 10362 10344 goto doc_load; 10363 10345 10364 - /* Note that we expect the location to be an absulute URI. */ 10346 + /* Note that we expect the location to be an absolute URI. */ 10365 10347 if (schemaLocation != NULL) { 10366 10348 bkt = xmlSchemaGetSchemaBucket(pctxt, schemaLocation); 10367 10349 if ((bkt != NULL) && ··· 10508 10490 10509 10491 /* 10510 10492 * Chameleon include/redefine: skip loading only if it was 10511 - * aleady build for the targetNamespace of the including 10493 + * already build for the targetNamespace of the including 10512 10494 * schema. 10513 10495 */ 10514 10496 /* ··· 10516 10498 * the components into the including schema and modify the 10517 10499 * targetNamespace of those components, do nothing otherwise. 10518 10500 * NOTE: This is currently worked-around by compiling the 10519 - * chameleon for every destinct including targetNamespace; thus 10501 + * chameleon for every distinct including targetNamespace; thus 10520 10502 * not performant at the moment. 10521 10503 * TODO: Check when the namespace in wildcards for chameleons 10522 10504 * needs to be converted: before we built wildcard intersections ··· 10707 10689 10708 10690 exit: 10709 10691 /* 10710 - * Return the bucket explicitely; this is needed for the 10692 + * Return the bucket explicitly; this is needed for the 10711 10693 * main schema. 10712 10694 */ 10713 10695 if (bucket != NULL) ··· 12888 12870 12889 12871 ret = 1; 12890 12872 /* 12891 - * If max and min occurances are default (1) then 12873 + * If max and min occurrences are default (1) then 12892 12874 * simply iterate over the particles of the <sequence>. 12893 12875 */ 12894 12876 if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) { ··· 13047 13029 particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; 13048 13030 13049 13031 /* 13050 - * use a counter to keep track of the number of transtions 13032 + * use a counter to keep track of the number of transitions 13051 13033 * which went through the choice. 13052 13034 */ 13053 13035 counter = ··· 13512 13494 * @source: the source wildcard 13513 13495 * 13514 13496 * Clones the namespace constraints of source 13515 - * and assignes them to dest. 13497 + * and assigns them to dest. 13516 13498 * Returns -1 on internal error, 0 otherwise. 13517 13499 */ 13518 13500 static int ··· 13735 13717 */ 13736 13718 xmlSchemaPErr(ctxt, completeWild->node, 13737 13719 XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, 13738 - "The union of the wilcard is not expressible.\n", 13720 + "The union of the wildcard is not expressible.\n", 13739 13721 NULL, NULL); 13740 13722 return(XML_SCHEMAP_UNION_NOT_EXPRESSIBLE); 13741 13723 } else if ((!nsFound) && (!absentFound)) { ··· 13972 13954 (curWild->negNsSet->value != NULL)) { 13973 13955 13974 13956 xmlSchemaPErr(ctxt, completeWild->node, XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, 13975 - "The intersection of the wilcard is not expressible.\n", 13957 + "The intersection of the wildcard is not expressible.\n", 13976 13958 NULL, NULL); 13977 13959 return(XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE); 13978 13960 } ··· 14443 14425 * Builds the wildcard and the attribute uses on the given complex type. 14444 14426 * Returns -1 if an internal error occurs, 0 otherwise. 14445 14427 * 14446 - * ATTENTION TODO: Experimantally this uses pointer comparisons for 14428 + * ATTENTION TODO: Experimentally this uses pointer comparisons for 14447 14429 * strings, so recheck this if we start to hardcode some schemata, since 14448 14430 * they might not be in the same dict. 14449 14431 * NOTE: It is allowed to "extend" the xs:anyType type. ··· 14643 14625 * Evaluates if a type definition contains the given "final". 14644 14626 * This does take "finalDefault" into account as well. 14645 14627 * 14646 - * Returns 1 if the type does containt the given "final", 14628 + * Returns 1 if the type does contain the given "final", 14647 14629 * 0 otherwise. 14648 14630 */ 14649 14631 static int ··· 14683 14665 * Schema Component Constraint: Effective Total Range 14684 14666 * (all and sequence) + (choice) 14685 14667 * 14686 - * Returns the minimun Effective Total Range. 14668 + * Returns the minimum Effective Total Range. 14687 14669 */ 14688 14670 static int 14689 14671 xmlSchemaGetParticleTotalRangeMin(xmlSchemaParticlePtr particle) ··· 14827 14809 * @actxt: a context 14828 14810 * @type: the derived simple type definition 14829 14811 * @baseType: the base type definition 14830 - * @subset: the subset of ('restriction', ect.) 14812 + * @subset: the subset of ('restriction', etc.) 14831 14813 * 14832 14814 * Schema Component Constraint: 14833 14815 * Type Derivation OK (Simple) (cos-st-derived-OK) 14834 14816 * 14835 - * Checks wheter @type can be validly 14817 + * Checks whether @type can be validly 14836 14818 * derived from @baseType. 14837 14819 * 14838 14820 * Returns 0 on success, an positive error code otherwise. ··· 14845 14827 { 14846 14828 /* 14847 14829 * 1 They are the same type definition. 14848 - * TODO: The identy check might have to be more complex than this. 14830 + * TODO: The identity check might have to be more complex than this. 14849 14831 */ 14850 14832 if (type == baseType) 14851 14833 return (0); ··· 15055 15037 * @ctxt: the parser context 15056 15038 * @name: the name 15057 15039 * 15058 - * Resolvese type definition references 15040 + * Resolves type definition references 15059 15041 */ 15060 15042 static void 15061 15043 xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, ··· 16132 16114 * Calls: 16133 16115 * Type Derivation OK (Simple) AND Type Derivation OK (Complex) 16134 16116 * 16135 - * Checks wheter @type can be validly derived from @baseType. 16117 + * Checks whether @type can be validly derived from @baseType. 16136 16118 * 16137 16119 * Returns 0 on success, an positive error code otherwise. 16138 16120 */ ··· 16265 16247 * if created the type via a schema construction API. 16266 16248 */ 16267 16249 if (base->attributeWildcard != NULL) { 16268 - if (type->attributeWilcard == NULL) { 16250 + if (type->attributeWildcard == NULL) { 16269 16251 xmlChar *str = NULL; 16270 16252 16271 16253 xmlSchemaCustomErr(ACTXT_CAST pctxt, ··· 16494 16476 * the {content type} is validly derived given the empty 16495 16477 * set as defined in Type Derivation OK (Simple) ($3.14.6)." 16496 16478 * 16497 - * ATTENTION TODO: This seems not needed if the type implicitely 16479 + * ATTENTION TODO: This seems not needed if the type implicitly 16498 16480 * derived from the base type. 16499 16481 * 16500 16482 */ ··· 17719 17701 * 17720 17702 * *Patterns*: won't be add here, since they are ORed at 17721 17703 * type level and ANDed at ancestor level. This will 17722 - * happed during validation by walking the base axis 17704 + * happen during validation by walking the base axis 17723 17705 * of the type. 17724 17706 */ 17725 17707 for (cur = base->facetSet; cur != NULL; cur = cur->next) { ··· 18319 18301 WXS_BASIC_CAST type, NULL, 18320 18302 "Internal error: xmlSchemaTypeFixup, " 18321 18303 "complex type '%s': the <simpleContent><restriction> " 18322 - "is missing a <simpleType> child, but was not catched " 18304 + "is missing a <simpleType> child, but was not caught " 18323 18305 "by xmlSchemaCheckSRCCT()", type->name); 18324 18306 goto exit_failure; 18325 18307 } ··· 18332 18314 if (baseType->contentTypeDef == NULL) { 18333 18315 /* 18334 18316 * TODO: Check if this ever happens. xmlSchemaCheckSRCCT 18335 - * should have catched this already. 18317 + * should have caught this already. 18336 18318 */ 18337 18319 xmlSchemaPCustomErr(pctxt, 18338 18320 XML_SCHEMAP_INTERNAL, ··· 18575 18557 * NOTE that, although we miss to add an intermediate 18576 18558 * <sequence>, this should produce no difference to 18577 18559 * neither the regex compilation of the content model, 18578 - * nor to the complex type contraints. 18560 + * nor to the complex type constraints. 18579 18561 */ 18580 18562 particle->children->children = 18581 18563 (xmlSchemaTreeItemPtr) baseType->subtypes; ··· 19000 18982 * is defined for model groups but not definitions, but since 19001 18983 * there cannot be any circular model groups without a model group 19002 18984 * definition (if not using a construction API), we check those 19003 - * defintions only. 18985 + * definitions only. 19004 18986 */ 19005 18987 xmlSchemaPCustomErr(ctxt, 19006 18988 XML_SCHEMAP_MG_PROPS_CORRECT_2, ··· 19073 19055 * This one is intended to be used by 19074 19056 * xmlSchemaCheckAttrGroupCircular only. 19075 19057 * 19076 - * Returns the circular attribute grou reference, otherwise NULL. 19058 + * Returns the circular attribute group reference, otherwise NULL. 19077 19059 */ 19078 19060 static xmlSchemaQNameRefPtr 19079 19061 xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, ··· 19187 19169 * @list: the attribute uses 19188 19170 * 19189 19171 * Substitutes contained attribute group references 19190 - * for their attribute uses. Wilcards are intersected. 19172 + * for their attribute uses. Wildcards are intersected. 19191 19173 * Attribute use prohibitions are removed from the list 19192 19174 * and returned via the @prohibs list. 19193 19175 * Pointlessness of attr. prohibs, if a matching attr. decl ··· 19361 19343 * {attribute wildcard} property 19362 19344 * 19363 19345 * Substitutes contained attribute group references 19364 - * for their attribute uses. Wilcards are intersected. 19346 + * for their attribute uses. Wildcards are intersected. 19365 19347 */ 19366 19348 static int 19367 19349 xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, ··· 19384 19366 * @attrGr: the attribute group definition 19385 19367 * 19386 19368 * Substitutes contained attribute group references 19387 - * for their attribute uses. Wilcards are intersected. 19369 + * for their attribute uses. Wildcards are intersected. 19388 19370 * 19389 19371 * Schema Component Constraint: 19390 19372 * Attribute Group Definition Properties Correct (ag-props-correct) ··· 19520 19502 * Attribute Declaration Properties Correct (a-props-correct) 19521 19503 * 19522 19504 * Validates the value constraints of an attribute declaration/use. 19523 - * NOTE that this needs the simle type definitions to be already 19524 - * builded and checked. 19505 + * NOTE that this needs the simple type definitions to be already 19506 + * built and checked. 19525 19507 */ 19526 19508 static int 19527 19509 xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, ··· 20508 20490 * it's not clear if the referenced component needs to originate 20509 20491 * from the <redefine>d schema _document_ or the schema; the latter 20510 20492 * would include all imported and included sub-schemas of the 20511 - * <redefine>d schema. Currenlty we latter approach is used. 20493 + * <redefine>d schema. Currently the latter approach is used. 20512 20494 * SUPPLEMENT: It seems that the WG moves towards the latter 20513 20495 * approach, so we are doing it right. 20514 20496 * ··· 20623 20605 * This is the complicated case: we need 20624 20606 * to apply src-redefine (7.2.2) at a later 20625 20607 * stage, i.e. when attribute group references 20626 - * have beed expanded and simple types have 20627 - * beed fixed. 20608 + * have been expanded and simple types have 20609 + * been fixed. 20628 20610 */ 20629 20611 redef->target = prev; 20630 20612 } ··· 20999 20981 * 1. the base axis of type definitions 21000 20982 * 2. nested model group definitions 21001 20983 * 3. nested attribute group definitions 21002 - * TODO: check for circual substitution groups. 20984 + * TODO: check for circular substitution groups. 21003 20985 */ 21004 20986 for (i = 0; i < nbItems; i++) { 21005 20987 item = items[i]; ··· 21080 21062 goto exit_error; 21081 21063 /* 21082 21064 * First compute the variety of simple types. This is needed as 21083 - * a seperate step, since otherwise we won't be able to detect 21065 + * a separate step, since otherwise we won't be able to detect 21084 21066 * circular union types in all cases. 21085 21067 */ 21086 21068 for (i = 0; i < nbItems; i++) { ··· 21142 21124 * At this point we need build and check all simple types. 21143 21125 */ 21144 21126 /* 21145 - * Apply contraints for attribute declarations. 21127 + * Apply constraints for attribute declarations. 21146 21128 */ 21147 21129 for (i = 0; i < nbItems; i++) { 21148 21130 item = items[i]; ··· 21207 21189 goto exit_error; 21208 21190 21209 21191 /* 21210 - * Complex types are builded and checked. 21192 + * Complex types are built and checked. 21211 21193 */ 21212 21194 for (i = 0; i < nbItems; i++) { 21213 21195 item = con->pending->items[i]; ··· 21324 21306 * @ctxt: a schema validation context 21325 21307 * 21326 21308 * parse a schema definition resource and build an internal 21327 - * XML Shema struture which can be used to validate instances. 21309 + * XML Schema structure which can be used to validate instances. 21328 21310 * 21329 21311 * Returns the internal XML Schema structure built from the resource or 21330 21312 * NULL in case of error ··· 21426 21408 exit_failure: 21427 21409 /* 21428 21410 * Quite verbose, but should catch internal errors, which were 21429 - * not communitated. 21411 + * not communicated. 21430 21412 */ 21431 21413 if (mainSchema) { 21432 21414 xmlSchemaFree(mainSchema); ··· 21893 21875 if ((vctxt->inode->node == NULL) || 21894 21876 (vctxt->inode->node->doc == NULL)) { 21895 21877 VERROR_INT("xmlSchemaLookupNamespace", 21896 - "no node or node's doc avaliable"); 21878 + "no node or node's doc available"); 21897 21879 return (NULL); 21898 21880 } 21899 21881 ns = xmlSearchNs(vctxt->inode->node->doc, ··· 22106 22088 xmlSchemaPSVIIDCNodePtr item) 22107 22089 { 22108 22090 /* 22109 - * Add to gobal list. 22091 + * Add to global list. 22110 22092 */ 22111 22093 if (vctxt->idcNodes == NULL) { 22112 22094 vctxt->idcNodes = (xmlSchemaPSVIIDCNodePtr *) ··· 22147 22129 xmlSchemaPSVIIDCKeyPtr key) 22148 22130 { 22149 22131 /* 22150 - * Add to gobal list. 22132 + * Add to global list. 22151 22133 */ 22152 22134 if (vctxt->idcKeys == NULL) { 22153 22135 vctxt->idcKeys = (xmlSchemaPSVIIDCKeyPtr *) ··· 22804 22786 VERROR(XML_SCHEMAV_CVC_IDC, 22805 22787 WXS_BASIC_CAST sto->matcher->aidc->def, 22806 22788 "Warning: No precomputed value available, the value " 22807 - "was either invalid or something strange happend"); 22789 + "was either invalid or something strange happened"); 22808 22790 sto->nbHistory--; 22809 22791 goto deregister_check; 22810 22792 } else { ··· 22825 22807 * <bar> 22826 22808 * </scope> 22827 22809 * 22828 - * The size of the list is only dependant on the depth of 22810 + * The size of the list is only dependent on the depth of 22829 22811 * the tree. 22830 22812 * An entry will be NULLed in selector_leave, i.e. when 22831 22813 * we hit the target's ··· 23366 23348 * Get/create the IDC binding on this element for the IDC definition. 23367 23349 */ 23368 23350 bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); 23351 + if (bind == NULL) 23352 + goto internal_error; 23369 23353 23370 23354 if (! WXS_ILIST_IS_EMPTY(bind->dupls)) { 23371 23355 dupls = (xmlSchemaPSVIIDCNodePtr *) bind->dupls->items; ··· 24118 24102 * @vctxt: the schema validation context 24119 24103 * 24120 24104 * Creates/reuses and initializes the element info item for 24121 - * the currect tree depth. 24105 + * the current tree depth. 24122 24106 * 24123 24107 * Returns the element info item or NULL on API or internal errors. 24124 24108 */ ··· 24391 24375 found = 1; 24392 24376 /* 24393 24377 * NOTE that for patterns, @value needs to be the 24394 - * normalized vaule. 24378 + * normalized value. 24395 24379 */ 24396 24380 ret = xmlRegexpExec(facetLink->facet->regexp, value); 24397 24381 if (ret == 1) ··· 24665 24649 ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; 24666 24650 } 24667 24651 } 24668 - if (fireErrors && (ret > 0)) 24652 + else if (fireErrors && (ret > 0)) 24669 24653 xmlSchemaSimpleTypeErr(actxt, ret, node, value, type, 1); 24670 24654 } else if (WXS_IS_LIST(type)) { 24671 24655 ··· 24928 24912 else { 24929 24913 const xmlChar *nsName = NULL, *local = NULL; 24930 24914 /* 24931 - * TODO: We should report a *warning* that the type was overriden 24915 + * TODO: We should report a *warning* that the type was overridden 24932 24916 * by the instance. 24933 24917 */ 24934 24918 ACTIVATE_ATTRIBUTE(iattr); ··· 26347 26331 XML_SCHEMA_ELEM_INFO_HAS_ELEM_CONTENT) { 26348 26332 ret = XML_SCHEMAV_CVC_ELT_5_2_2_1; 26349 26333 VERROR(ret, NULL, 26350 - "The content must not containt element nodes since " 26334 + "The content must not contain element nodes since " 26351 26335 "there is a fixed value constraint"); 26352 26336 goto end_elem; 26353 26337 } else { ··· 26554 26538 if (ptype->builtInType == XML_SCHEMAS_ANYTYPE) { 26555 26539 /* 26556 26540 * Workaround for "anyType": we have currently no content model 26557 - * assigned for "anyType", so handle it explicitely. 26541 + * assigned for "anyType", so handle it explicitly. 26558 26542 * "anyType" has an unbounded, lax "any" wildcard. 26559 26543 */ 26560 26544 vctxt->inode->decl = xmlSchemaGetElem(vctxt->schema, ··· 26629 26613 return (-1); 26630 26614 } 26631 26615 /* 26632 - * Safety belf for evaluation if the cont. model was already 26616 + * Safety belt for evaluation if the cont. model was already 26633 26617 * examined to be invalid. 26634 26618 */ 26635 26619 if (pielem->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) { ··· 28818 28802 * 28819 28803 * Internal locator function for the readers 28820 28804 * 28821 - * Returns 0 in case the Schema validation could be (des)activated and 28805 + * Returns 0 in case the Schema validation could be (de)activated and 28822 28806 * -1 in case of error. 28823 28807 */ 28824 28808 static int
+11 -9
sdk/lib/3rdparty/libxml2/xmlschemastypes.c
··· 70 70 unsigned int hour :5; /* 0 <= hour <= 24 */ 71 71 unsigned int min :6; /* 0 <= min <= 59 */ 72 72 double sec; 73 - unsigned int tz_flag :1; /* is tzo explicitely set? */ 73 + unsigned int tz_flag :1; /* is tzo explicitly set? */ 74 74 signed int tzo :12; /* -1440 <= tzo <= 1440; 75 75 currently only -840 to +840 are needed */ 76 76 }; ··· 1129 1129 #define VALID_HOUR(hr) ((hr >= 0) && (hr <= 23)) 1130 1130 #define VALID_MIN(min) ((min >= 0) && (min <= 59)) 1131 1131 #define VALID_SEC(sec) ((sec >= 0) && (sec < 60)) 1132 - #define VALID_TZO(tzo) ((tzo > -840) && (tzo < 840)) 1132 + #define VALID_TZO(tzo) ((tzo >= -840) && (tzo <= 840)) 1133 1133 #define IS_LEAP(y) \ 1134 1134 (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) 1135 1135 ··· 2130 2130 * @value: the value to check 2131 2131 * @val: the return computed value 2132 2132 * @node: the node containing the value 2133 - * flags: flags to control the vlidation 2133 + * flags: flags to control the validation 2134 2134 * 2135 2135 * Check that a value conforms to the lexical space of the atomic type. 2136 2136 * if true a value is computed and returned in @val. ··· 2155 2155 return (-1); 2156 2156 2157 2157 /* 2158 - * validating a non existant text node is similar to validating 2158 + * validating a non existent text node is similar to validating 2159 2159 * an empty one. 2160 2160 */ 2161 2161 if (value == NULL) ··· 2925 2925 if (*value != 0) { 2926 2926 xmlURIPtr uri; 2927 2927 xmlChar *tmpval, *cur; 2928 - if (normOnTheFly) { 2928 + if ((norm == NULL) && (normOnTheFly)) { 2929 2929 norm = xmlSchemaCollapseString(value); 2930 2930 if (norm != NULL) 2931 2931 value = norm; ··· 3067 3067 * following cases can arise: (1) the final quantum of 3068 3068 * encoding input is an integral multiple of 24 bits; here, 3069 3069 * the final unit of encoded output will be an integral 3070 - * multiple ofindent: Standard input:701: Warning:old style 3070 + * multiple of indent: Standard input:701: Warning:old style 3071 3071 * assignment ambiguity in "=*". Assuming "= *" 4 characters 3072 3072 * with no "=" padding, (2) the final 3073 3073 * quantum of encoding input is exactly 8 bits; here, the ··· 3628 3628 minday = 0; 3629 3629 maxday = 0; 3630 3630 } else { 3631 - maxday = 366 * ((myear + 3) / 4) + 3632 - 365 * ((myear - 1) % 4); 3631 + /* FIXME: This doesn't take leap year exceptions every 100/400 years 3632 + into account. */ 3633 + maxday = 365 * myear + (myear + 3) / 4; 3634 + /* FIXME: Needs to be calculated separately */ 3633 3635 minday = maxday - 1; 3634 3636 } 3635 3637 ··· 3877 3879 3878 3880 temp = r->mon + carry; 3879 3881 r->mon = (unsigned int) MODULO_RANGE(temp, 1, 13); 3880 - r->year = r->year + (unsigned int) FQUOTIENT_RANGE(temp, 1, 13); 3882 + r->year = r->year + (long) FQUOTIENT_RANGE(temp, 1, 13); 3881 3883 if (r->year == 0) { 3882 3884 if (temp < 1) 3883 3885 r->year--;
+3 -3
sdk/lib/3rdparty/libxml2/xmlwriter.c
··· 541 541 if (encoding != NULL) { 542 542 encoder = xmlFindCharEncodingHandler(encoding); 543 543 if (encoder == NULL) { 544 - xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, 545 - "xmlTextWriterStartDocument : out of memory!\n"); 544 + xmlWriterErrMsg(writer, XML_ERR_UNSUPPORTED_ENCODING, 545 + "xmlTextWriterStartDocument : unsupported encoding\n"); 546 546 return -1; 547 547 } 548 548 } ··· 801 801 * xmlTextWriterEndComment: 802 802 * @writer: the xmlTextWriterPtr 803 803 * 804 - * End the current xml coment. 804 + * End the current xml comment. 805 805 * 806 806 * Returns the bytes written (may be 0 because of buffering) or -1 in case of error 807 807 */
+638 -1059
sdk/lib/3rdparty/libxml2/xpath.c
··· 343 343 } 344 344 345 345 /* 346 - * Speedup using document order if availble. 346 + * Speedup using document order if available. 347 347 */ 348 348 if ((node1->type == XML_ELEMENT_NODE) && 349 349 (node2->type == XML_ELEMENT_NODE) && ··· 411 411 if (node1 == node2->next) 412 412 return(-1); 413 413 /* 414 - * Speedup using document order if availble. 414 + * Speedup using document order if available. 415 415 */ 416 416 if ((node1->type == XML_ELEMENT_NODE) && 417 417 (node2->type == XML_ELEMENT_NODE) && ··· 435 435 #endif /* XP_OPTIMIZED_NON_ELEM_COMPARISON */ 436 436 437 437 /* 438 - * Wrapper for the Timsort argorithm from timsort.h 438 + * Wrapper for the Timsort algorithm from timsort.h 439 439 */ 440 440 #ifdef WITH_TIM_SORT 441 441 #define SORT_NAME libxml_domnode ··· 610 610 "Invalid or incomplete context\n", 611 611 "Stack usage error\n", 612 612 "Forbidden variable\n", 613 + "Operation limit exceeded\n", 614 + "Recursion limit exceeded\n", 613 615 "?? Unknown error ??\n" /* Must be last in the list! */ 614 616 }; 615 617 #define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) / \ ··· 625 627 xmlXPathErrMemory(xmlXPathContextPtr ctxt, const char *extra) 626 628 { 627 629 if (ctxt != NULL) { 630 + xmlResetError(&ctxt->lastError); 628 631 if (extra) { 629 632 xmlChar buf[200]; 630 633 ··· 747 750 xmlXPathErr(ctxt, no); 748 751 } 749 752 753 + /** 754 + * xmlXPathCheckOpLimit: 755 + * @ctxt: the XPath Parser context 756 + * @opCount: the number of operations to be added 757 + * 758 + * Adds opCount to the running total of operations and returns -1 if the 759 + * operation limit is exceeded. Returns 0 otherwise. 760 + */ 761 + static int 762 + xmlXPathCheckOpLimit(xmlXPathParserContextPtr ctxt, unsigned long opCount) { 763 + xmlXPathContextPtr xpctxt = ctxt->context; 764 + 765 + if ((opCount > xpctxt->opLimit) || 766 + (xpctxt->opCount > xpctxt->opLimit - opCount)) { 767 + xpctxt->opCount = xpctxt->opLimit; 768 + xmlXPathErr(ctxt, XPATH_OP_LIMIT_EXCEEDED); 769 + return(-1); 770 + } 771 + 772 + xpctxt->opCount += opCount; 773 + return(0); 774 + } 775 + 776 + #define OP_LIMIT_EXCEEDED(ctxt, n) \ 777 + ((ctxt->context->opLimit != 0) && (xmlXPathCheckOpLimit(ctxt, n) < 0)) 778 + 750 779 /************************************************************************ 751 780 * * 752 781 * Utilities * ··· 1076 1105 * Returns -1 in case of failure, the index otherwise 1077 1106 */ 1078 1107 static int 1079 - xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2, 1108 + xmlXPathCompExprAdd(xmlXPathParserContextPtr ctxt, int ch1, int ch2, 1080 1109 xmlXPathOp op, int value, 1081 1110 int value2, int value3, void *value4, void *value5) { 1111 + xmlXPathCompExprPtr comp = ctxt->comp; 1082 1112 if (comp->nbStep >= comp->maxStep) { 1083 1113 xmlXPathStepOp *real; 1084 1114 1085 1115 if (comp->maxStep >= XPATH_MAX_STEPS) { 1086 - xmlXPathErrMemory(NULL, "adding step\n"); 1116 + xmlXPathPErrMemory(ctxt, "adding step\n"); 1087 1117 return(-1); 1088 1118 } 1089 1119 comp->maxStep *= 2; ··· 1091 1121 comp->maxStep * sizeof(xmlXPathStepOp)); 1092 1122 if (real == NULL) { 1093 1123 comp->maxStep /= 2; 1094 - xmlXPathErrMemory(NULL, "adding step\n"); 1124 + xmlXPathPErrMemory(ctxt, "adding step\n"); 1095 1125 return(-1); 1096 1126 } 1097 1127 comp->steps = real; ··· 1153 1183 } 1154 1184 1155 1185 #define PUSH_FULL_EXPR(op, op1, op2, val, val2, val3, val4, val5) \ 1156 - xmlXPathCompExprAdd(ctxt->comp, (op1), (op2), \ 1186 + xmlXPathCompExprAdd(ctxt, (op1), (op2), \ 1157 1187 (op), (val), (val2), (val3), (val4), (val5)) 1158 1188 #define PUSH_LONG_EXPR(op, val, val2, val3, val4, val5) \ 1159 - xmlXPathCompExprAdd(ctxt->comp, ctxt->comp->last, -1, \ 1189 + xmlXPathCompExprAdd(ctxt, ctxt->comp->last, -1, \ 1160 1190 (op), (val), (val2), (val3), (val4), (val5)) 1161 1191 1162 1192 #define PUSH_LEAVE_EXPR(op, val, val2) \ 1163 - xmlXPathCompExprAdd(ctxt->comp, -1, -1, (op), (val), (val2), 0 ,NULL ,NULL) 1193 + xmlXPathCompExprAdd(ctxt, -1, -1, (op), (val), (val2), 0 ,NULL ,NULL) 1164 1194 1165 1195 #define PUSH_UNARY_EXPR(op, ch, val, val2) \ 1166 - xmlXPathCompExprAdd(ctxt->comp, (ch), -1, (op), (val), (val2), 0 ,NULL ,NULL) 1196 + xmlXPathCompExprAdd(ctxt, (ch), -1, (op), (val), (val2), 0 ,NULL ,NULL) 1167 1197 1168 1198 #define PUSH_BINARY_EXPR(op, ch1, ch2, val, val2) \ 1169 - xmlXPathCompExprAdd(ctxt->comp, (ch1), (ch2), (op), \ 1199 + xmlXPathCompExprAdd(ctxt, (ch1), (ch2), (op), \ 1170 1200 (val), (val2), 0 ,NULL ,NULL) 1171 1201 1172 1202 /************************************************************************ ··· 2226 2256 * 2227 2257 * @ctxt: the XPath context 2228 2258 * @active: enables/disables (creates/frees) the cache 2229 - * @value: a value with semantics dependant on @options 2259 + * @value: a value with semantics dependent on @options 2230 2260 * @options: options (currently only the value 0 is used) 2231 2261 * 2232 2262 * Creates/frees an object cache on the XPath context. ··· 2386 2416 { 2387 2417 xmlXPathObjectPtr ret; 2388 2418 /* 2389 - * Use the nodset-cache. 2419 + * Use the nodeset-cache. 2390 2420 */ 2391 2421 ret = (xmlXPathObjectPtr) 2392 2422 cache->nodesetObjs->items[--cache->nodesetObjs->number]; ··· 2396 2426 if ((ret->nodesetval->nodeMax == 0) || 2397 2427 (val->type == XML_NAMESPACE_DECL)) 2398 2428 { 2429 + /* TODO: Check memory error. */ 2399 2430 xmlXPathNodeSetAddUnique(ret->nodesetval, val); 2400 2431 } else { 2401 2432 ret->nodesetval->nodeTab[0] = val; ··· 2842 2873 * @ctxt: an XPath evaluation context 2843 2874 * @value: the XPath object 2844 2875 * 2845 - * Pushes a new XPath object on top of the value stack 2876 + * Pushes a new XPath object on top of the value stack. If value is NULL, 2877 + * a memory error is recorded in the parser context. 2846 2878 * 2847 - * returns the number of items on the value stack 2879 + * Returns the number of items on the value stack, or -1 in case of error. 2848 2880 */ 2849 2881 int 2850 2882 valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value) 2851 2883 { 2852 - if ((ctxt == NULL) || (value == NULL)) return(-1); 2884 + if (ctxt == NULL) return(-1); 2885 + if (value == NULL) { 2886 + /* 2887 + * A NULL value typically indicates that a memory allocation failed, 2888 + * so we set ctxt->error here to propagate the error. 2889 + */ 2890 + ctxt->error = XPATH_MEMORY_ERROR; 2891 + return(-1); 2892 + } 2853 2893 if (ctxt->valueNr >= ctxt->valueMax) { 2854 2894 xmlXPathObjectPtr *tmp; 2855 2895 2856 2896 if (ctxt->valueMax >= XPATH_MAX_STACK_DEPTH) { 2857 - xmlXPathErrMemory(NULL, "XPath stack depth limit reached\n"); 2858 - ctxt->error = XPATH_MEMORY_ERROR; 2859 - return (0); 2897 + xmlXPathPErrMemory(ctxt, "XPath stack depth limit reached\n"); 2898 + return (-1); 2860 2899 } 2861 2900 tmp = (xmlXPathObjectPtr *) xmlRealloc(ctxt->valueTab, 2862 2901 2 * ctxt->valueMax * 2863 2902 sizeof(ctxt->valueTab[0])); 2864 2903 if (tmp == NULL) { 2865 - xmlXPathErrMemory(NULL, "pushing value\n"); 2866 - ctxt->error = XPATH_MEMORY_ERROR; 2867 - return (0); 2904 + xmlXPathPErrMemory(ctxt, "pushing value\n"); 2905 + return (-1); 2868 2906 } 2869 2907 ctxt->valueMax *= 2; 2870 2908 ctxt->valueTab = tmp; ··· 3320 3358 return(-1); 3321 3359 3322 3360 /* 3323 - * Speedup using document order if availble. 3361 + * Speedup using document order if available. 3324 3362 */ 3325 3363 if ((node1->type == XML_ELEMENT_NODE) && 3326 3364 (node2->type == XML_ELEMENT_NODE) && ··· 3383 3421 if (node1 == node2->next) 3384 3422 return(-1); 3385 3423 /* 3386 - * Speedup using document order if availble. 3424 + * Speedup using document order if available. 3387 3425 */ 3388 3426 if ((node1->type == XML_ELEMENT_NODE) && 3389 3427 (node2->type == XML_ELEMENT_NODE) && ··· 3547 3585 if (val->type == XML_NAMESPACE_DECL) { 3548 3586 xmlNsPtr ns = (xmlNsPtr) val; 3549 3587 3588 + /* TODO: Check memory error. */ 3550 3589 ret->nodeTab[ret->nodeNr++] = 3551 3590 xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); 3552 3591 } else ··· 3556 3595 } 3557 3596 3558 3597 /** 3559 - * xmlXPathNodeSetCreateSize: 3560 - * @size: the initial size of the set 3561 - * 3562 - * Create a new xmlNodeSetPtr of type double and of value @val 3563 - * 3564 - * Returns the newly created object. 3565 - */ 3566 - static xmlNodeSetPtr 3567 - xmlXPathNodeSetCreateSize(int size) { 3568 - xmlNodeSetPtr ret; 3569 - 3570 - ret = (xmlNodeSetPtr) xmlMalloc(sizeof(xmlNodeSet)); 3571 - if (ret == NULL) { 3572 - xmlXPathErrMemory(NULL, "creating nodeset\n"); 3573 - return(NULL); 3574 - } 3575 - memset(ret, 0 , (size_t) sizeof(xmlNodeSet)); 3576 - if (size < XML_NODESET_DEFAULT) 3577 - size = XML_NODESET_DEFAULT; 3578 - ret->nodeTab = (xmlNodePtr *) xmlMalloc(size * sizeof(xmlNodePtr)); 3579 - if (ret->nodeTab == NULL) { 3580 - xmlXPathErrMemory(NULL, "creating nodeset\n"); 3581 - xmlFree(ret); 3582 - return(NULL); 3583 - } 3584 - memset(ret->nodeTab, 0 , size * (size_t) sizeof(xmlNodePtr)); 3585 - ret->nodeMax = size; 3586 - return(ret); 3587 - } 3588 - 3589 - /** 3590 3598 * xmlXPathNodeSetContains: 3591 3599 * @cur: the node-set 3592 3600 * @val: the node ··· 3684 3692 cur->nodeMax *= 2; 3685 3693 cur->nodeTab = temp; 3686 3694 } 3695 + /* TODO: Check memory error. */ 3687 3696 cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs(node, ns); 3688 3697 return(0); 3689 3698 } ··· 3742 3751 if (val->type == XML_NAMESPACE_DECL) { 3743 3752 xmlNsPtr ns = (xmlNsPtr) val; 3744 3753 3754 + /* TODO: Check memory error. */ 3745 3755 cur->nodeTab[cur->nodeNr++] = 3746 3756 xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); 3747 3757 } else ··· 3796 3806 if (val->type == XML_NAMESPACE_DECL) { 3797 3807 xmlNsPtr ns = (xmlNsPtr) val; 3798 3808 3809 + /* TODO: Check memory error. */ 3799 3810 cur->nodeTab[cur->nodeNr++] = 3800 3811 xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); 3801 3812 } else ··· 3830 3841 * xmlXPathNodeSetDupNs() to the set; thus a pure 3831 3842 * memcpy is not possible. 3832 3843 * If there was a flag on the nodesetval, indicating that 3833 - * some temporary nodes are in, that would be helpfull. 3844 + * some temporary nodes are in, that would be helpful. 3834 3845 */ 3835 3846 /* 3836 3847 * Optimization: Create an equally sized node-set ··· 3912 3923 if (n2->type == XML_NAMESPACE_DECL) { 3913 3924 xmlNsPtr ns = (xmlNsPtr) n2; 3914 3925 3926 + /* TODO: Check memory error. */ 3915 3927 val1->nodeTab[val1->nodeNr++] = 3916 3928 xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); 3917 3929 } else ··· 3926 3938 * xmlXPathNodeSetMergeAndClear: 3927 3939 * @set1: the first NodeSet or NULL 3928 3940 * @set2: the second NodeSet 3929 - * @hasSet2NsNodes: 1 if set2 contains namespaces nodes 3930 3941 * 3931 - * Merges two nodesets, all nodes from @set2 are added to @set1 3932 - * if @set1 is NULL, a new set is created and copied from @set2. 3942 + * Merges two nodesets, all nodes from @set2 are added to @set1. 3933 3943 * Checks for duplicate nodes. Clears set2. 3934 3944 * 3935 3945 * Returns @set1 once extended or NULL in case of error. 3936 3946 */ 3937 3947 static xmlNodeSetPtr 3938 - xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, 3939 - int hasNullEntries) 3948 + xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2) 3940 3949 { 3941 - if ((set1 == NULL) && (hasNullEntries == 0)) { 3942 - /* 3943 - * Note that doing a memcpy of the list, namespace nodes are 3944 - * just assigned to set1, since set2 is cleared anyway. 3945 - */ 3946 - set1 = xmlXPathNodeSetCreateSize(set2->nodeNr); 3947 - if (set1 == NULL) 3948 - return(NULL); 3949 - if (set2->nodeNr != 0) { 3950 - memcpy(set1->nodeTab, set2->nodeTab, 3951 - set2->nodeNr * sizeof(xmlNodePtr)); 3952 - set1->nodeNr = set2->nodeNr; 3953 - } 3954 - } else { 3950 + { 3955 3951 int i, j, initNbSet1; 3956 3952 xmlNodePtr n1, n2; 3957 - 3958 - if (set1 == NULL) 3959 - set1 = xmlXPathNodeSetCreate(NULL); 3960 - if (set1 == NULL) 3961 - return (NULL); 3962 3953 3963 3954 initNbSet1 = set1->nodeNr; 3964 3955 for (i = 0;i < set2->nodeNr;i++) { 3965 3956 n2 = set2->nodeTab[i]; 3966 - /* 3967 - * Skip NULLed entries. 3968 - */ 3969 - if (n2 == NULL) 3970 - continue; 3971 3957 /* 3972 3958 * Skip duplicates. 3973 3959 */ ··· 4033 4019 * xmlXPathNodeSetMergeAndClearNoDupls: 4034 4020 * @set1: the first NodeSet or NULL 4035 4021 * @set2: the second NodeSet 4036 - * @hasSet2NsNodes: 1 if set2 contains namespaces nodes 4037 4022 * 4038 - * Merges two nodesets, all nodes from @set2 are added to @set1 4039 - * if @set1 is NULL, a new set is created and copied from @set2. 4040 - * Doesn't chack for duplicate nodes. Clears set2. 4023 + * Merges two nodesets, all nodes from @set2 are added to @set1. 4024 + * Doesn't check for duplicate nodes. Clears set2. 4041 4025 * 4042 4026 * Returns @set1 once extended or NULL in case of error. 4043 4027 */ 4044 4028 static xmlNodeSetPtr 4045 - xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, 4046 - int hasNullEntries) 4029 + xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2) 4047 4030 { 4048 - if (set2 == NULL) 4049 - return(set1); 4050 - if ((set1 == NULL) && (hasNullEntries == 0)) { 4051 - /* 4052 - * Note that doing a memcpy of the list, namespace nodes are 4053 - * just assigned to set1, since set2 is cleared anyway. 4054 - */ 4055 - set1 = xmlXPathNodeSetCreateSize(set2->nodeNr); 4056 - if (set1 == NULL) 4057 - return(NULL); 4058 - if (set2->nodeNr != 0) { 4059 - memcpy(set1->nodeTab, set2->nodeTab, 4060 - set2->nodeNr * sizeof(xmlNodePtr)); 4061 - set1->nodeNr = set2->nodeNr; 4062 - } 4063 - } else { 4031 + { 4064 4032 int i; 4065 4033 xmlNodePtr n2; 4066 - 4067 - if (set1 == NULL) 4068 - set1 = xmlXPathNodeSetCreate(NULL); 4069 - if (set1 == NULL) 4070 - return (NULL); 4071 4034 4072 4035 for (i = 0;i < set2->nodeNr;i++) { 4073 4036 n2 = set2->nodeTab[i]; 4074 - /* 4075 - * Skip NULLed entries. 4076 - */ 4077 - if (n2 == NULL) 4078 - continue; 4079 4037 if (set1->nodeMax == 0) { 4080 4038 set1->nodeTab = (xmlNodePtr *) xmlMalloc( 4081 4039 XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); ··· 4346 4304 memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); 4347 4305 ret->type = XPATH_NODESET; 4348 4306 ret->boolval = 0; 4307 + /* TODO: Check memory error. */ 4349 4308 ret->nodesetval = xmlXPathNodeSetCreate(val); 4350 4309 /* @@ with_ns to check whether namespace nodes should be looked at @@ */ 4351 4310 #ifdef XP_DEBUG_OBJ_USAGE ··· 4406 4365 ret = xmlXPathNewNodeSet(val->nodeTab[0]); 4407 4366 if (ret) { 4408 4367 for (i = 1; i < val->nodeNr; ++i) { 4368 + /* TODO: Propagate memory error. */ 4409 4369 if (xmlXPathNodeSetAddUnique(ret->nodesetval, val->nodeTab[i]) 4410 4370 < 0) break; 4411 4371 } ··· 4477 4437 if (xmlXPathNodeSetIsEmpty(nodes2)) 4478 4438 return(nodes1); 4479 4439 4440 + /* TODO: Check memory error. */ 4480 4441 ret = xmlXPathNodeSetCreate(NULL); 4481 4442 if (xmlXPathNodeSetIsEmpty(nodes1)) 4482 4443 return(ret); ··· 4486 4447 for (i = 0; i < l1; i++) { 4487 4448 cur = xmlXPathNodeSetItem(nodes1, i); 4488 4449 if (!xmlXPathNodeSetContains(nodes2, cur)) { 4450 + /* TODO: Propagate memory error. */ 4489 4451 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) 4490 4452 break; 4491 4453 } ··· 4522 4484 for (i = 0; i < l1; i++) { 4523 4485 cur = xmlXPathNodeSetItem(nodes1, i); 4524 4486 if (xmlXPathNodeSetContains(nodes2, cur)) { 4487 + /* TODO: Propagate memory error. */ 4525 4488 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) 4526 4489 break; 4527 4490 } ··· 4560 4523 strval = xmlXPathCastNodeToString(cur); 4561 4524 if (xmlHashLookup(hash, strval) == NULL) { 4562 4525 xmlHashAddEntry(hash, strval, strval); 4526 + /* TODO: Propagate memory error. */ 4563 4527 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) 4564 4528 break; 4565 4529 } else { ··· 4653 4617 cur = xmlXPathNodeSetItem(nodes, i); 4654 4618 if (cur == node) 4655 4619 break; 4620 + /* TODO: Propagate memory error. */ 4656 4621 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) 4657 4622 break; 4658 4623 } ··· 4758 4723 cur = xmlXPathNodeSetItem(nodes, i); 4759 4724 if (cur == node) 4760 4725 break; 4726 + /* TODO: Propagate memory error. */ 4761 4727 if (xmlXPathNodeSetAddUnique(ret, cur) < 0) 4762 4728 break; 4763 4729 } ··· 5457 5423 break; 5458 5424 #endif 5459 5425 case XPATH_NODESET: 5426 + /* TODO: Check memory error. */ 5460 5427 ret->nodesetval = xmlXPathNodeSetMerge(NULL, val->nodesetval); 5461 5428 /* Do not deallocate the copied tree value */ 5462 5429 ret->boolval = 0; ··· 5944 5911 return(NAN); 5945 5912 switch (val->type) { 5946 5913 case XPATH_UNDEFINED: 5947 - #ifdef DEGUB_EXPR 5914 + #ifdef DEBUG_EXPR 5948 5915 xmlGenericError(xmlGenericErrorContext, "NUMBER: undefined\n"); 5949 5916 #endif 5950 5917 ret = NAN; ··· 6153 6120 ret->contextSize = -1; 6154 6121 ret->proximityPosition = -1; 6155 6122 6123 + ret->maxDepth = INT_MAX; 6124 + ret->maxParserDepth = INT_MAX; 6125 + 6156 6126 #ifdef XP_DEFAULT_CACHE_ON 6157 6127 if (xmlXPathContextSetCache(ret, 1, -1, 0) == -1) { 6158 6128 xmlXPathFreeContext(ret); ··· 6643 6613 6644 6614 values2 = (double *) xmlMalloc(ns2->nodeNr * sizeof(double)); 6645 6615 if (values2 == NULL) { 6616 + /* TODO: Propagate memory error. */ 6646 6617 xmlXPathErrMemory(NULL, "comparing nodesets\n"); 6647 6618 xmlXPathFreeObject(arg1); 6648 6619 xmlXPathFreeObject(arg2); ··· 6903 6874 6904 6875 values1 = (xmlChar **) xmlMalloc(ns1->nodeNr * sizeof(xmlChar *)); 6905 6876 if (values1 == NULL) { 6877 + /* TODO: Propagate memory error. */ 6906 6878 xmlXPathErrMemory(NULL, "comparing nodesets\n"); 6907 6879 return(0); 6908 6880 } 6909 6881 hashs1 = (unsigned int *) xmlMalloc(ns1->nodeNr * sizeof(unsigned int)); 6910 6882 if (hashs1 == NULL) { 6883 + /* TODO: Propagate memory error. */ 6911 6884 xmlXPathErrMemory(NULL, "comparing nodesets\n"); 6912 6885 xmlFree(values1); 6913 6886 return(0); ··· 6915 6888 memset(values1, 0, ns1->nodeNr * sizeof(xmlChar *)); 6916 6889 values2 = (xmlChar **) xmlMalloc(ns2->nodeNr * sizeof(xmlChar *)); 6917 6890 if (values2 == NULL) { 6891 + /* TODO: Propagate memory error. */ 6918 6892 xmlXPathErrMemory(NULL, "comparing nodesets\n"); 6919 6893 xmlFree(hashs1); 6920 6894 xmlFree(values1); ··· 6922 6896 } 6923 6897 hashs2 = (unsigned int *) xmlMalloc(ns2->nodeNr * sizeof(unsigned int)); 6924 6898 if (hashs2 == NULL) { 6899 + /* TODO: Propagate memory error. */ 6925 6900 xmlXPathErrMemory(NULL, "comparing nodesets\n"); 6926 6901 xmlFree(hashs1); 6927 6902 xmlFree(values1); ··· 7551 7526 * The numeric operators convert their operands to numbers as if 7552 7527 * by calling the number function. 7553 7528 */ 7529 + ATTRIBUTE_NO_SANITIZE("float-divide-by-zero") 7554 7530 void 7555 7531 xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { 7556 7532 xmlXPathObjectPtr arg; ··· 7623 7599 * Used for merging node sets in xmlXPathCollectAndTest(). 7624 7600 */ 7625 7601 typedef xmlNodeSetPtr (*xmlXPathNodeSetMergeFunction) 7626 - (xmlNodeSetPtr, xmlNodeSetPtr, int); 7602 + (xmlNodeSetPtr, xmlNodeSetPtr); 7627 7603 7628 7604 7629 7605 /** ··· 8562 8538 8563 8539 if ((cur == NULL) || (cur->nodesetval == NULL)) 8564 8540 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); 8565 - else if ((cur->type == XPATH_NODESET) || (cur->type == XPATH_XSLT_TREE)) { 8541 + else 8566 8542 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, 8567 8543 (double) cur->nodesetval->nodeNr)); 8568 - } else { 8569 - if ((cur->nodesetval->nodeNr != 1) || 8570 - (cur->nodesetval->nodeTab == NULL)) { 8571 - valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); 8572 - } else { 8573 - xmlNodePtr tmp; 8574 - int i = 0; 8575 - 8576 - tmp = cur->nodesetval->nodeTab[0]; 8577 - if ((tmp != NULL) && (tmp->type != XML_NAMESPACE_DECL)) { 8578 - tmp = tmp->children; 8579 - while (tmp != NULL) { 8580 - tmp = tmp->next; 8581 - i++; 8582 - } 8583 - } 8584 - valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) i)); 8585 - } 8586 - } 8587 8544 xmlXPathReleaseObject(ctxt->context, cur); 8588 8545 } 8589 8546 ··· 8621 8578 * We used to check the fact that the value passed 8622 8579 * was an NCName, but this generated much troubles for 8623 8580 * me and Aleksey Sanin, people blatantly violated that 8624 - * constaint, like Visa3D spec. 8581 + * constraint, like Visa3D spec. 8625 8582 * if (xmlValidateNCName(ID, 1) == 0) 8626 8583 */ 8627 8584 attr = xmlGetID(doc, ID); ··· 8632 8589 elem = (xmlNodePtr) attr; 8633 8590 else 8634 8591 elem = NULL; 8592 + /* TODO: Check memory error. */ 8635 8593 if (elem != NULL) 8636 8594 xmlXPathNodeSetAdd(ret, elem); 8637 8595 } ··· 8675 8633 xmlNodeSetPtr ns; 8676 8634 int i; 8677 8635 8636 + /* TODO: Check memory error. */ 8678 8637 ret = xmlXPathNodeSetCreate(NULL); 8679 - /* 8680 - * FIXME -- in an out-of-memory condition this will behave badly. 8681 - * The solution is not clear -- we already popped an item from 8682 - * ctxt, so the object is in a corrupt state. 8683 - */ 8684 8638 8685 8639 if (obj->nodesetval != NULL) { 8686 8640 for (i = 0; i < obj->nodesetval->nodeNr; i++) { 8687 8641 tokens = 8688 8642 xmlXPathCastNodeToString(obj->nodesetval->nodeTab[i]); 8689 8643 ns = xmlXPathGetElementsByIds(ctxt->context->doc, tokens); 8644 + /* TODO: Check memory error. */ 8690 8645 ret = xmlXPathNodeSetMerge(ret, ns); 8691 8646 xmlXPathFreeNodeSet(ns); 8692 8647 if (tokens != NULL) ··· 8698 8653 return; 8699 8654 } 8700 8655 obj = xmlXPathCacheConvertString(ctxt->context, obj); 8656 + if (obj == NULL) return; 8701 8657 ret = xmlXPathGetElementsByIds(ctxt->context->doc, obj->stringval); 8702 8658 valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); 8703 8659 xmlXPathReleaseObject(ctxt->context, obj); ··· 9135 9091 xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { 9136 9092 xmlXPathObjectPtr str, start, len; 9137 9093 double le=0, in; 9138 - int i, l, m; 9139 - xmlChar *ret; 9094 + int i = 1, j = INT_MAX; 9140 9095 9141 9096 if (nargs < 2) { 9142 9097 CHECK_ARITY(2); ··· 9163 9118 CAST_TO_STRING; 9164 9119 CHECK_TYPE(XPATH_STRING); 9165 9120 str = valuePop(ctxt); 9166 - m = xmlUTF8Strlen((const unsigned char *)str->stringval); 9167 9121 9168 - /* 9169 - * If last pos not present, calculate last position 9170 - */ 9171 - if (nargs != 3) { 9172 - le = (double)m; 9173 - if (in < 1.0) 9174 - in = 1.0; 9122 + if (!(in < INT_MAX)) { /* Logical NOT to handle NaNs */ 9123 + i = INT_MAX; 9124 + } else if (in >= 1.0) { 9125 + i = (int)in; 9126 + if (in - floor(in) >= 0.5) 9127 + i += 1; 9175 9128 } 9176 9129 9177 - /* Need to check for the special cases where either 9178 - * the index is NaN, the length is NaN, or both 9179 - * arguments are infinity (relying on Inf + -Inf = NaN) 9180 - */ 9181 - if (!xmlXPathIsInf(in) && !xmlXPathIsNaN(in + le)) { 9182 - /* 9183 - * To meet the requirements of the spec, the arguments 9184 - * must be converted to integer format before 9185 - * initial index calculations are done 9186 - * 9187 - * First we go to integer form, rounding up 9188 - * and checking for special cases 9189 - */ 9190 - i = (int) in; 9191 - if (((double)i)+0.5 <= in) i++; 9130 + if (nargs == 3) { 9131 + double rin, rle, end; 9192 9132 9193 - if (xmlXPathIsInf(le) == 1) { 9194 - l = m; 9195 - if (i < 1) 9196 - i = 1; 9197 - } 9198 - else if (xmlXPathIsInf(le) == -1 || le < 0.0) 9199 - l = 0; 9200 - else { 9201 - l = (int) le; 9202 - if (((double)l)+0.5 <= le) l++; 9203 - } 9133 + rin = floor(in); 9134 + if (in - rin >= 0.5) 9135 + rin += 1.0; 9204 9136 9205 - /* Now we normalize inidices */ 9206 - i -= 1; 9207 - l += i; 9208 - if (i < 0) 9209 - i = 0; 9210 - if (l > m) 9211 - l = m; 9137 + rle = floor(le); 9138 + if (le - rle >= 0.5) 9139 + rle += 1.0; 9212 9140 9213 - /* number of chars to copy */ 9214 - l -= i; 9215 - 9216 - ret = xmlUTF8Strsub(str->stringval, i, l); 9217 - } 9218 - else { 9219 - ret = NULL; 9141 + end = rin + rle; 9142 + if (!(end >= 1.0)) { /* Logical NOT to handle NaNs */ 9143 + j = 1; 9144 + } else if (end < INT_MAX) { 9145 + j = (int)end; 9146 + } 9220 9147 } 9221 - if (ret == NULL) 9222 - valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); 9223 - else { 9148 + 9149 + if (i < j) { 9150 + xmlChar *ret = xmlUTF8Strsub(str->stringval, i - 1, j - i); 9224 9151 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, ret)); 9225 9152 xmlFree(ret); 9153 + } else { 9154 + valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); 9226 9155 } 9156 + 9227 9157 xmlXPathReleaseObject(ctxt->context, str); 9228 9158 } 9229 9159 ··· 9682 9612 CAST_TO_NUMBER; 9683 9613 CHECK_TYPE(XPATH_NUMBER); 9684 9614 9615 + #ifdef _AIX 9616 + /* Work around buggy ceil() function on AIX */ 9617 + ctxt->value->floatval = copysign(ceil(ctxt->value->floatval), ctxt->value->floatval); 9618 + #else 9685 9619 ctxt->value->floatval = ceil(ctxt->value->floatval); 9620 + #endif 9686 9621 } 9687 9622 9688 9623 /** ··· 9999 9934 (IS_COMBINING(c)) || 10000 9935 (IS_EXTENDER(c))) { 10001 9936 if (len + 10 > max) { 9937 + xmlChar *tmp; 10002 9938 if (max > XML_MAX_NAME_LENGTH) { 9939 + xmlFree(buffer); 10003 9940 XP_ERRORNULL(XPATH_EXPR_ERROR); 10004 9941 } 10005 9942 max *= 2; 10006 - buffer = (xmlChar *) xmlRealloc(buffer, 10007 - max * sizeof(xmlChar)); 10008 - if (buffer == NULL) { 9943 + tmp = (xmlChar *) xmlRealloc(buffer, 9944 + max * sizeof(xmlChar)); 9945 + if (tmp == NULL) { 9946 + xmlFree(buffer); 10009 9947 XP_ERRORNULL(XPATH_MEMORY_ERROR); 10010 9948 } 9949 + buffer = tmp; 10011 9950 } 10012 9951 COPY_BUF(l,buffer,len,c); 10013 9952 NEXTL(l); ··· 10899 10838 xmlXPathCompAdditiveExpr(ctxt); 10900 10839 CHECK_ERROR; 10901 10840 SKIP_BLANKS; 10902 - while ((CUR == '<') || 10903 - (CUR == '>') || 10904 - ((CUR == '<') && (NXT(1) == '=')) || 10905 - ((CUR == '>') && (NXT(1) == '='))) { 10841 + while ((CUR == '<') || (CUR == '>')) { 10906 10842 int inf, strict; 10907 10843 int op1 = ctxt->comp->last; 10908 10844 ··· 10995 10931 */ 10996 10932 static void 10997 10933 xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) { 10934 + xmlXPathContextPtr xpctxt = ctxt->context; 10935 + 10936 + if (xpctxt != NULL) { 10937 + if (xpctxt->depth >= xpctxt->maxParserDepth) 10938 + XP_ERROR(XPATH_RECURSION_LIMIT_EXCEEDED); 10939 + xpctxt->depth += 1; 10940 + } 10941 + 10998 10942 xmlXPathCompAndExpr(ctxt); 10999 10943 CHECK_ERROR; 11000 10944 SKIP_BLANKS; ··· 11016 10960 */ 11017 10961 PUSH_UNARY_EXPR(XPATH_OP_SORT, ctxt->comp->last , 0, 0); 11018 10962 } 10963 + 10964 + if (xpctxt != NULL) 10965 + xpctxt->depth -= 1; 11019 10966 } 11020 10967 11021 10968 /** ··· 11634 11581 } 11635 11582 #endif /* DEBUG_STEP */ 11636 11583 11637 - static int 11638 - xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, 11639 - xmlXPathStepOpPtr op, 11640 - xmlNodeSetPtr set, 11641 - int contextSize, 11642 - int hasNsNodes) 11584 + /** 11585 + * xmlXPathNodeSetFilter: 11586 + * @ctxt: the XPath Parser context 11587 + * @set: the node set to filter 11588 + * @filterOpIndex: the index of the predicate/filter op 11589 + * @minPos: minimum position in the filtered set (1-based) 11590 + * @maxPos: maximum position in the filtered set (1-based) 11591 + * @hasNsNodes: true if the node set may contain namespace nodes 11592 + * 11593 + * Filter a node set, keeping only nodes for which the predicate expression 11594 + * matches. Afterwards, keep only nodes between minPos and maxPos in the 11595 + * filtered result. 11596 + */ 11597 + static void 11598 + xmlXPathNodeSetFilter(xmlXPathParserContextPtr ctxt, 11599 + xmlNodeSetPtr set, 11600 + int filterOpIndex, 11601 + int minPos, int maxPos, 11602 + int hasNsNodes) 11643 11603 { 11644 - if (op->ch1 != -1) { 11645 - xmlXPathCompExprPtr comp = ctxt->comp; 11646 - /* 11647 - * Process inner predicates first. 11648 - */ 11649 - if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) { 11650 - /* 11651 - * TODO: raise an internal error. 11652 - */ 11653 - } 11654 - contextSize = xmlXPathCompOpEvalPredicate(ctxt, 11655 - &comp->steps[op->ch1], set, contextSize, hasNsNodes); 11656 - CHECK_ERROR0; 11657 - if (contextSize <= 0) 11658 - return(0); 11604 + xmlXPathContextPtr xpctxt; 11605 + xmlNodePtr oldnode; 11606 + xmlDocPtr olddoc; 11607 + xmlXPathStepOpPtr filterOp; 11608 + int oldcs, oldpp; 11609 + int i, j, pos; 11610 + 11611 + if ((set == NULL) || (set->nodeNr == 0)) 11612 + return; 11613 + 11614 + /* 11615 + * Check if the node set contains a sufficient number of nodes for 11616 + * the requested range. 11617 + */ 11618 + if (set->nodeNr < minPos) { 11619 + xmlXPathNodeSetClear(set, hasNsNodes); 11620 + return; 11659 11621 } 11660 - if (op->ch2 != -1) { 11661 - xmlXPathContextPtr xpctxt = ctxt->context; 11662 - xmlNodePtr contextNode, oldContextNode; 11663 - xmlDocPtr oldContextDoc; 11664 - int oldcs, oldpp; 11665 - int i, res, contextPos = 0, newContextSize; 11666 - xmlXPathStepOpPtr exprOp; 11667 - xmlXPathObjectPtr contextObj = NULL, exprRes = NULL; 11622 + 11623 + xpctxt = ctxt->context; 11624 + oldnode = xpctxt->node; 11625 + olddoc = xpctxt->doc; 11626 + oldcs = xpctxt->contextSize; 11627 + oldpp = xpctxt->proximityPosition; 11628 + filterOp = &ctxt->comp->steps[filterOpIndex]; 11629 + 11630 + xpctxt->contextSize = set->nodeNr; 11631 + 11632 + for (i = 0, j = 0, pos = 1; i < set->nodeNr; i++) { 11633 + xmlNodePtr node = set->nodeTab[i]; 11634 + int res; 11668 11635 11669 - #ifdef LIBXML_XPTR_ENABLED 11670 - /* 11671 - * URGENT TODO: Check the following: 11672 - * We don't expect location sets if evaluating prediates, right? 11673 - * Only filters should expect location sets, right? 11674 - */ 11675 - #endif 11676 - /* 11677 - * SPEC XPath 1.0: 11678 - * "For each node in the node-set to be filtered, the 11679 - * PredicateExpr is evaluated with that node as the 11680 - * context node, with the number of nodes in the 11681 - * node-set as the context size, and with the proximity 11682 - * position of the node in the node-set with respect to 11683 - * the axis as the context position;" 11684 - * @oldset is the node-set" to be filtered. 11685 - * 11686 - * SPEC XPath 1.0: 11687 - * "only predicates change the context position and 11688 - * context size (see [2.4 Predicates])." 11689 - * Example: 11690 - * node-set context pos 11691 - * nA 1 11692 - * nB 2 11693 - * nC 3 11694 - * After applying predicate [position() > 1] : 11695 - * node-set context pos 11696 - * nB 1 11697 - * nC 2 11698 - */ 11699 - oldContextNode = xpctxt->node; 11700 - oldContextDoc = xpctxt->doc; 11701 - oldcs = xpctxt->contextSize; 11702 - oldpp = xpctxt->proximityPosition; 11703 - /* 11704 - * Get the expression of this predicate. 11705 - */ 11706 - exprOp = &ctxt->comp->steps[op->ch2]; 11707 - newContextSize = 0; 11708 - for (i = 0; i < set->nodeNr; i++) { 11709 - if (set->nodeTab[i] == NULL) 11710 - continue; 11636 + xpctxt->node = node; 11637 + xpctxt->proximityPosition = i + 1; 11711 11638 11712 - contextNode = set->nodeTab[i]; 11713 - xpctxt->node = contextNode; 11714 - xpctxt->contextSize = contextSize; 11715 - xpctxt->proximityPosition = ++contextPos; 11639 + /* 11640 + * Also set the xpath document in case things like 11641 + * key() are evaluated in the predicate. 11642 + * 11643 + * TODO: Get real doc for namespace nodes. 11644 + */ 11645 + if ((node->type != XML_NAMESPACE_DECL) && 11646 + (node->doc != NULL)) 11647 + xpctxt->doc = node->doc; 11716 11648 11717 - /* 11718 - * Also set the xpath document in case things like 11719 - * key() are evaluated in the predicate. 11720 - */ 11721 - if ((contextNode->type != XML_NAMESPACE_DECL) && 11722 - (contextNode->doc != NULL)) 11723 - xpctxt->doc = contextNode->doc; 11724 - /* 11725 - * Evaluate the predicate expression with 1 context node 11726 - * at a time; this node is packaged into a node set; this 11727 - * node set is handed over to the evaluation mechanism. 11728 - */ 11729 - if (contextObj == NULL) 11730 - contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); 11731 - else { 11732 - if (xmlXPathNodeSetAddUnique(contextObj->nodesetval, 11733 - contextNode) < 0) { 11734 - ctxt->error = XPATH_MEMORY_ERROR; 11735 - goto evaluation_exit; 11736 - } 11737 - } 11649 + res = xmlXPathCompOpEvalToBoolean(ctxt, filterOp, 1); 11738 11650 11739 - valuePush(ctxt, contextObj); 11651 + if (ctxt->error != XPATH_EXPRESSION_OK) 11652 + goto exit; 11653 + if (res < 0) { 11654 + /* Shouldn't happen */ 11655 + xmlXPathErr(ctxt, XPATH_EXPR_ERROR); 11656 + goto exit; 11657 + } 11740 11658 11741 - res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); 11659 + if ((res != 0) && ((pos >= minPos) && (pos <= maxPos))) { 11660 + if (i != j) { 11661 + set->nodeTab[j] = node; 11662 + set->nodeTab[i] = NULL; 11663 + } 11742 11664 11743 - if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { 11744 - xmlXPathNodeSetClear(set, hasNsNodes); 11745 - newContextSize = 0; 11746 - goto evaluation_exit; 11747 - } 11665 + j += 1; 11666 + } else { 11667 + /* Remove the entry from the initial node set. */ 11668 + set->nodeTab[i] = NULL; 11669 + if (node->type == XML_NAMESPACE_DECL) 11670 + xmlXPathNodeSetFreeNs((xmlNsPtr) node); 11671 + } 11748 11672 11749 - if (res != 0) { 11750 - newContextSize++; 11751 - } else { 11752 - /* 11753 - * Remove the entry from the initial node set. 11754 - */ 11755 - set->nodeTab[i] = NULL; 11756 - if (contextNode->type == XML_NAMESPACE_DECL) 11757 - xmlXPathNodeSetFreeNs((xmlNsPtr) contextNode); 11758 - } 11759 - if (ctxt->value == contextObj) { 11760 - /* 11761 - * Don't free the temporary XPath object holding the 11762 - * context node, in order to avoid massive recreation 11763 - * inside this loop. 11764 - */ 11765 - valuePop(ctxt); 11766 - xmlXPathNodeSetClear(contextObj->nodesetval, hasNsNodes); 11767 - } else { 11768 - /* 11769 - * TODO: The object was lost in the evaluation machinery. 11770 - * Can this happen? Maybe in internal-error cases. 11771 - */ 11772 - contextObj = NULL; 11773 - } 11774 - } 11673 + if (res != 0) { 11674 + if (pos == maxPos) { 11675 + /* Clear remaining nodes and exit loop. */ 11676 + if (hasNsNodes) { 11677 + for (i++; i < set->nodeNr; i++) { 11678 + node = set->nodeTab[i]; 11679 + if ((node != NULL) && 11680 + (node->type == XML_NAMESPACE_DECL)) 11681 + xmlXPathNodeSetFreeNs((xmlNsPtr) node); 11682 + } 11683 + } 11684 + break; 11685 + } 11775 11686 11776 - if (contextObj != NULL) { 11777 - if (ctxt->value == contextObj) 11778 - valuePop(ctxt); 11779 - xmlXPathReleaseObject(xpctxt, contextObj); 11780 - } 11781 - evaluation_exit: 11782 - if (exprRes != NULL) 11783 - xmlXPathReleaseObject(ctxt->context, exprRes); 11784 - /* 11785 - * Reset/invalidate the context. 11786 - */ 11787 - xpctxt->node = oldContextNode; 11788 - xpctxt->doc = oldContextDoc; 11789 - xpctxt->contextSize = oldcs; 11790 - xpctxt->proximityPosition = oldpp; 11791 - return(newContextSize); 11687 + pos += 1; 11688 + } 11792 11689 } 11793 - return(contextSize); 11794 - } 11690 + 11691 + set->nodeNr = j; 11692 + 11693 + /* If too many elements were removed, shrink table to preserve memory. */ 11694 + if ((set->nodeMax > XML_NODESET_DEFAULT) && 11695 + (set->nodeNr < set->nodeMax / 2)) { 11696 + xmlNodePtr *tmp; 11697 + int nodeMax = set->nodeNr; 11795 11698 11796 - static int 11797 - xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, 11798 - xmlXPathStepOpPtr op, 11799 - xmlNodeSetPtr set, 11800 - int contextSize, 11801 - int minPos, 11802 - int maxPos, 11803 - int hasNsNodes) 11804 - { 11805 - if (op->ch1 != -1) { 11806 - xmlXPathCompExprPtr comp = ctxt->comp; 11807 - if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) { 11808 - /* 11809 - * TODO: raise an internal error. 11810 - */ 11811 - } 11812 - contextSize = xmlXPathCompOpEvalPredicate(ctxt, 11813 - &comp->steps[op->ch1], set, contextSize, hasNsNodes); 11814 - CHECK_ERROR0; 11815 - if (contextSize <= 0) 11816 - return(0); 11817 - } 11818 - /* 11819 - * Check if the node set contains a sufficient number of nodes for 11820 - * the requested range. 11821 - */ 11822 - if (contextSize < minPos) { 11823 - xmlXPathNodeSetClear(set, hasNsNodes); 11824 - return(0); 11699 + if (nodeMax < XML_NODESET_DEFAULT) 11700 + nodeMax = XML_NODESET_DEFAULT; 11701 + tmp = (xmlNodePtr *) xmlRealloc(set->nodeTab, 11702 + nodeMax * sizeof(xmlNodePtr)); 11703 + if (tmp == NULL) { 11704 + xmlXPathPErrMemory(ctxt, "shrinking nodeset\n"); 11705 + } else { 11706 + set->nodeTab = tmp; 11707 + set->nodeMax = nodeMax; 11708 + } 11825 11709 } 11826 - if (op->ch2 == -1) { 11827 - /* 11828 - * TODO: Can this ever happen? 11829 - */ 11830 - return (contextSize); 11831 - } else { 11832 - xmlDocPtr oldContextDoc; 11833 - int oldcs, oldpp; 11834 - int i, pos = 0, newContextSize = 0, contextPos = 0, res; 11835 - xmlXPathStepOpPtr exprOp; 11836 - xmlXPathObjectPtr contextObj = NULL, exprRes = NULL; 11837 - xmlNodePtr oldContextNode, contextNode = NULL; 11838 - xmlXPathContextPtr xpctxt = ctxt->context; 11839 - int frame; 11710 + 11711 + exit: 11712 + xpctxt->node = oldnode; 11713 + xpctxt->doc = olddoc; 11714 + xpctxt->contextSize = oldcs; 11715 + xpctxt->proximityPosition = oldpp; 11716 + } 11840 11717 11841 11718 #ifdef LIBXML_XPTR_ENABLED 11842 - /* 11843 - * URGENT TODO: Check the following: 11844 - * We don't expect location sets if evaluating prediates, right? 11845 - * Only filters should expect location sets, right? 11846 - */ 11847 - #endif /* LIBXML_XPTR_ENABLED */ 11719 + /** 11720 + * xmlXPathLocationSetFilter: 11721 + * @ctxt: the XPath Parser context 11722 + * @locset: the location set to filter 11723 + * @filterOpIndex: the index of the predicate/filter op 11724 + * @minPos: minimum position in the filtered set (1-based) 11725 + * @maxPos: maximum position in the filtered set (1-based) 11726 + * 11727 + * Filter a location set, keeping only nodes for which the predicate 11728 + * expression matches. Afterwards, keep only nodes between minPos and maxPos 11729 + * in the filtered result. 11730 + */ 11731 + static void 11732 + xmlXPathLocationSetFilter(xmlXPathParserContextPtr ctxt, 11733 + xmlLocationSetPtr locset, 11734 + int filterOpIndex, 11735 + int minPos, int maxPos) 11736 + { 11737 + xmlXPathContextPtr xpctxt; 11738 + xmlNodePtr oldnode; 11739 + xmlDocPtr olddoc; 11740 + xmlXPathStepOpPtr filterOp; 11741 + int oldcs, oldpp; 11742 + int i, j, pos; 11848 11743 11849 - /* 11850 - * Save old context. 11851 - */ 11852 - oldContextNode = xpctxt->node; 11853 - oldContextDoc = xpctxt->doc; 11854 - oldcs = xpctxt->contextSize; 11855 - oldpp = xpctxt->proximityPosition; 11856 - /* 11857 - * Get the expression of this predicate. 11858 - */ 11859 - exprOp = &ctxt->comp->steps[op->ch2]; 11860 - for (i = 0; i < set->nodeNr; i++) { 11861 - xmlXPathObjectPtr tmp; 11744 + if ((locset == NULL) || (locset->locNr == 0) || (filterOpIndex == -1)) 11745 + return; 11862 11746 11863 - if (set->nodeTab[i] == NULL) 11864 - continue; 11747 + xpctxt = ctxt->context; 11748 + oldnode = xpctxt->node; 11749 + olddoc = xpctxt->doc; 11750 + oldcs = xpctxt->contextSize; 11751 + oldpp = xpctxt->proximityPosition; 11752 + filterOp = &ctxt->comp->steps[filterOpIndex]; 11865 11753 11866 - contextNode = set->nodeTab[i]; 11867 - xpctxt->node = contextNode; 11868 - xpctxt->contextSize = contextSize; 11869 - xpctxt->proximityPosition = ++contextPos; 11754 + xpctxt->contextSize = locset->locNr; 11870 11755 11871 - /* 11872 - * Initialize the new set. 11873 - * Also set the xpath document in case things like 11874 - * key() evaluation are attempted on the predicate 11875 - */ 11876 - if ((contextNode->type != XML_NAMESPACE_DECL) && 11877 - (contextNode->doc != NULL)) 11878 - xpctxt->doc = contextNode->doc; 11879 - /* 11880 - * Evaluate the predicate expression with 1 context node 11881 - * at a time; this node is packaged into a node set; this 11882 - * node set is handed over to the evaluation mechanism. 11883 - */ 11884 - if (contextObj == NULL) 11885 - contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); 11886 - else { 11887 - if (xmlXPathNodeSetAddUnique(contextObj->nodesetval, 11888 - contextNode) < 0) { 11889 - ctxt->error = XPATH_MEMORY_ERROR; 11890 - goto evaluation_exit; 11891 - } 11892 - } 11756 + for (i = 0, j = 0, pos = 1; i < locset->locNr; i++) { 11757 + xmlNodePtr contextNode = locset->locTab[i]->user; 11758 + int res; 11759 + 11760 + xpctxt->node = contextNode; 11761 + xpctxt->proximityPosition = i + 1; 11762 + 11763 + /* 11764 + * Also set the xpath document in case things like 11765 + * key() are evaluated in the predicate. 11766 + * 11767 + * TODO: Get real doc for namespace nodes. 11768 + */ 11769 + if ((contextNode->type != XML_NAMESPACE_DECL) && 11770 + (contextNode->doc != NULL)) 11771 + xpctxt->doc = contextNode->doc; 11772 + 11773 + res = xmlXPathCompOpEvalToBoolean(ctxt, filterOp, 1); 11774 + 11775 + if (ctxt->error != XPATH_EXPRESSION_OK) 11776 + goto exit; 11777 + if (res < 0) { 11778 + /* Shouldn't happen */ 11779 + xmlXPathErr(ctxt, XPATH_EXPR_ERROR); 11780 + goto exit; 11781 + } 11893 11782 11894 - valuePush(ctxt, contextObj); 11895 - frame = xmlXPathSetFrame(ctxt); 11896 - res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); 11897 - xmlXPathPopFrame(ctxt, frame); 11898 - tmp = valuePop(ctxt); 11783 + if ((res != 0) && ((pos >= minPos) && (pos <= maxPos))) { 11784 + if (i != j) { 11785 + locset->locTab[j] = locset->locTab[i]; 11786 + locset->locTab[i] = NULL; 11787 + } 11899 11788 11900 - if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { 11901 - while (tmp != contextObj) { 11902 - /* 11903 - * Free up the result 11904 - * then pop off contextObj, which will be freed later 11905 - */ 11906 - xmlXPathReleaseObject(xpctxt, tmp); 11907 - tmp = valuePop(ctxt); 11789 + j += 1; 11790 + } else { 11791 + /* Remove the entry from the initial location set. */ 11792 + xmlXPathFreeObject(locset->locTab[i]); 11793 + locset->locTab[i] = NULL; 11794 + } 11795 + 11796 + if (res != 0) { 11797 + if (pos == maxPos) { 11798 + /* Clear remaining nodes and exit loop. */ 11799 + for (i++; i < locset->locNr; i++) { 11800 + xmlXPathFreeObject(locset->locTab[i]); 11908 11801 } 11909 - goto evaluation_error; 11910 - } 11911 - /* push the result back onto the stack */ 11912 - valuePush(ctxt, tmp); 11802 + break; 11803 + } 11804 + 11805 + pos += 1; 11806 + } 11807 + } 11808 + 11809 + locset->locNr = j; 11913 11810 11914 - if (res) 11915 - pos++; 11811 + /* If too many elements were removed, shrink table to preserve memory. */ 11812 + if ((locset->locMax > XML_NODESET_DEFAULT) && 11813 + (locset->locNr < locset->locMax / 2)) { 11814 + xmlXPathObjectPtr *tmp; 11815 + int locMax = locset->locNr; 11916 11816 11917 - if (res && (pos >= minPos) && (pos <= maxPos)) { 11918 - /* 11919 - * Fits in the requested range. 11920 - */ 11921 - newContextSize++; 11922 - if (minPos == maxPos) { 11923 - /* 11924 - * Only 1 node was requested. 11925 - */ 11926 - if (contextNode->type == XML_NAMESPACE_DECL) { 11927 - /* 11928 - * As always: take care of those nasty 11929 - * namespace nodes. 11930 - */ 11931 - set->nodeTab[i] = NULL; 11932 - } 11933 - xmlXPathNodeSetClear(set, hasNsNodes); 11934 - set->nodeNr = 1; 11935 - set->nodeTab[0] = contextNode; 11936 - goto evaluation_exit; 11937 - } 11938 - if (pos == maxPos) { 11939 - /* 11940 - * We are done. 11941 - */ 11942 - xmlXPathNodeSetClearFromPos(set, i +1, hasNsNodes); 11943 - goto evaluation_exit; 11944 - } 11945 - } else { 11946 - /* 11947 - * Remove the entry from the initial node set. 11948 - */ 11949 - set->nodeTab[i] = NULL; 11950 - if (contextNode->type == XML_NAMESPACE_DECL) 11951 - xmlXPathNodeSetFreeNs((xmlNsPtr) contextNode); 11952 - } 11953 - if (exprRes != NULL) { 11954 - xmlXPathReleaseObject(ctxt->context, exprRes); 11955 - exprRes = NULL; 11956 - } 11957 - if (ctxt->value == contextObj) { 11958 - /* 11959 - * Don't free the temporary XPath object holding the 11960 - * context node, in order to avoid massive recreation 11961 - * inside this loop. 11962 - */ 11963 - valuePop(ctxt); 11964 - xmlXPathNodeSetClear(contextObj->nodesetval, hasNsNodes); 11965 - } else { 11966 - /* 11967 - * The object was lost in the evaluation machinery. 11968 - * Can this happen? Maybe in case of internal-errors. 11969 - */ 11970 - contextObj = NULL; 11971 - } 11972 - } 11973 - goto evaluation_exit; 11817 + if (locMax < XML_NODESET_DEFAULT) 11818 + locMax = XML_NODESET_DEFAULT; 11819 + tmp = (xmlXPathObjectPtr *) xmlRealloc(locset->locTab, 11820 + locMax * sizeof(xmlXPathObjectPtr)); 11821 + if (tmp == NULL) { 11822 + xmlXPathPErrMemory(ctxt, "shrinking locset\n"); 11823 + } else { 11824 + locset->locTab = tmp; 11825 + locset->locMax = locMax; 11826 + } 11827 + } 11974 11828 11975 - evaluation_error: 11976 - xmlXPathNodeSetClear(set, hasNsNodes); 11977 - newContextSize = 0; 11829 + exit: 11830 + xpctxt->node = oldnode; 11831 + xpctxt->doc = olddoc; 11832 + xpctxt->contextSize = oldcs; 11833 + xpctxt->proximityPosition = oldpp; 11834 + } 11835 + #endif /* LIBXML_XPTR_ENABLED */ 11978 11836 11979 - evaluation_exit: 11980 - if (contextObj != NULL) { 11981 - if (ctxt->value == contextObj) 11982 - valuePop(ctxt); 11983 - xmlXPathReleaseObject(xpctxt, contextObj); 11984 - } 11985 - if (exprRes != NULL) 11986 - xmlXPathReleaseObject(ctxt->context, exprRes); 11837 + /** 11838 + * xmlXPathCompOpEvalPredicate: 11839 + * @ctxt: the XPath Parser context 11840 + * @op: the predicate op 11841 + * @set: the node set to filter 11842 + * @minPos: minimum position in the filtered set (1-based) 11843 + * @maxPos: maximum position in the filtered set (1-based) 11844 + * @hasNsNodes: true if the node set may contain namespace nodes 11845 + * 11846 + * Filter a node set, keeping only nodes for which the sequence of predicate 11847 + * expressions matches. Afterwards, keep only nodes between minPos and maxPos 11848 + * in the filtered result. 11849 + */ 11850 + static void 11851 + xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, 11852 + xmlXPathStepOpPtr op, 11853 + xmlNodeSetPtr set, 11854 + int minPos, int maxPos, 11855 + int hasNsNodes) 11856 + { 11857 + if (op->ch1 != -1) { 11858 + xmlXPathCompExprPtr comp = ctxt->comp; 11987 11859 /* 11988 - * Reset/invalidate the context. 11860 + * Process inner predicates first. 11989 11861 */ 11990 - xpctxt->node = oldContextNode; 11991 - xpctxt->doc = oldContextDoc; 11992 - xpctxt->contextSize = oldcs; 11993 - xpctxt->proximityPosition = oldpp; 11994 - return(newContextSize); 11862 + if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) { 11863 + xmlGenericError(xmlGenericErrorContext, 11864 + "xmlXPathCompOpEvalPredicate: Expected a predicate\n"); 11865 + XP_ERROR(XPATH_INVALID_OPERAND); 11866 + } 11867 + if (ctxt->context->depth >= ctxt->context->maxDepth) 11868 + XP_ERROR(XPATH_RECURSION_LIMIT_EXCEEDED); 11869 + ctxt->context->depth += 1; 11870 + xmlXPathCompOpEvalPredicate(ctxt, &comp->steps[op->ch1], set, 11871 + 1, set->nodeNr, hasNsNodes); 11872 + ctxt->context->depth -= 1; 11873 + CHECK_ERROR; 11995 11874 } 11996 - return(contextSize); 11875 + 11876 + if (op->ch2 != -1) 11877 + xmlXPathNodeSetFilter(ctxt, set, op->ch2, minPos, maxPos, hasNsNodes); 11997 11878 } 11998 11879 11999 11880 static int ··· 12013 11894 * 1) For predicates (XPATH_OP_PREDICATE): 12014 11895 * - an inner predicate operator 12015 11896 * 2) For filters (XPATH_OP_FILTER): 12016 - * - an inner filter operater OR 11897 + * - an inner filter operator OR 12017 11898 * - an expression selecting the node set. 12018 11899 * E.g. "key('a', 'b')" or "(//foo | //bar)". 12019 11900 */ ··· 12111 11992 /* First predicate operator */ 12112 11993 xmlXPathStepOpPtr predOp; 12113 11994 int maxPos; /* The requested position() (when a "[n]" predicate) */ 12114 - int hasPredicateRange, hasAxisRange, pos, size, newSize; 11995 + int hasPredicateRange, hasAxisRange, pos; 12115 11996 int breakOnFirstHit; 12116 11997 12117 11998 xmlXPathTraversalFunction next = NULL; ··· 12304 12185 if (seq == NULL) { 12305 12186 seq = xmlXPathNodeSetCreate(NULL); 12306 12187 if (seq == NULL) { 12188 + /* TODO: Propagate memory error. */ 12307 12189 total = 0; 12308 12190 goto error; 12309 12191 } ··· 12315 12197 cur = NULL; 12316 12198 hasNsNodes = 0; 12317 12199 do { 12200 + if (OP_LIMIT_EXCEEDED(ctxt, 1)) 12201 + goto error; 12202 + 12318 12203 cur = next(ctxt, cur); 12319 12204 if (cur == NULL) 12320 12205 break; ··· 12522 12407 outSeq = seq; 12523 12408 seq = NULL; 12524 12409 } else 12525 - outSeq = mergeAndClear(outSeq, seq, 0); 12410 + /* TODO: Check memory error. */ 12411 + outSeq = mergeAndClear(outSeq, seq); 12526 12412 /* 12527 12413 * Break if only a true/false result was requested. 12528 12414 */ ··· 12539 12425 outSeq = seq; 12540 12426 seq = NULL; 12541 12427 } else 12542 - outSeq = mergeAndClear(outSeq, seq, 0); 12428 + /* TODO: Check memory error. */ 12429 + outSeq = mergeAndClear(outSeq, seq); 12543 12430 break; 12544 12431 12545 12432 #ifdef DEBUG_STEP ··· 12583 12470 * For the moment, I'll try to solve this with a recursive 12584 12471 * function: xmlXPathCompOpEvalPredicate(). 12585 12472 */ 12586 - size = seq->nodeNr; 12587 12473 if (hasPredicateRange != 0) 12588 - newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt, 12589 - predOp, seq, size, maxPos, maxPos, hasNsNodes); 12474 + xmlXPathCompOpEvalPredicate(ctxt, predOp, seq, maxPos, maxPos, 12475 + hasNsNodes); 12590 12476 else 12591 - newSize = xmlXPathCompOpEvalPredicate(ctxt, 12592 - predOp, seq, size, hasNsNodes); 12477 + xmlXPathCompOpEvalPredicate(ctxt, predOp, seq, 1, seq->nodeNr, 12478 + hasNsNodes); 12593 12479 12594 12480 if (ctxt->error != XPATH_EXPRESSION_OK) { 12595 12481 total = 0; 12596 12482 goto error; 12597 12483 } 12598 - /* 12599 - * Add the filtered set of nodes to the result node set. 12600 - */ 12601 - if (newSize == 0) { 12602 - /* 12603 - * The predicates filtered all nodes out. 12604 - */ 12605 - xmlXPathNodeSetClear(seq, hasNsNodes); 12606 - } else if (seq->nodeNr > 0) { 12607 - /* 12608 - * Add to result set. 12609 - */ 12610 - if (outSeq == NULL) { 12611 - if (size != newSize) { 12612 - /* 12613 - * We need to merge and clear here, since 12614 - * the sequence will contained NULLed entries. 12615 - */ 12616 - outSeq = mergeAndClear(NULL, seq, 1); 12617 - } else { 12618 - outSeq = seq; 12619 - seq = NULL; 12620 - } 12621 - } else 12622 - outSeq = mergeAndClear(outSeq, seq, 12623 - (size != newSize) ? 1: 0); 12624 - /* 12625 - * Break if only a true/false result was requested. 12626 - */ 12627 - if (toBool) 12628 - break; 12629 - } 12630 - } else if (seq->nodeNr > 0) { 12484 + } 12485 + 12486 + if (seq->nodeNr > 0) { 12631 12487 /* 12632 12488 * Add to result set. 12633 12489 */ ··· 12635 12491 outSeq = seq; 12636 12492 seq = NULL; 12637 12493 } else { 12638 - outSeq = mergeAndClear(outSeq, seq, 0); 12494 + /* TODO: Check memory error. */ 12495 + outSeq = mergeAndClear(outSeq, seq); 12639 12496 } 12497 + 12498 + if (toBool) 12499 + break; 12640 12500 } 12641 12501 } 12642 12502 ··· 12655 12515 xmlXPathReleaseObject(xpctxt, obj); 12656 12516 12657 12517 /* 12658 - * Ensure we return at least an emtpy set. 12518 + * Ensure we return at least an empty set. 12659 12519 */ 12660 12520 if (outSeq == NULL) { 12661 12521 if ((seq != NULL) && (seq->nodeNr == 0)) 12662 12522 outSeq = seq; 12663 12523 else 12524 + /* TODO: Check memory error. */ 12664 12525 outSeq = xmlXPathNodeSetCreate(NULL); 12665 - /* XXX what if xmlXPathNodeSetCreate returned NULL here? */ 12666 12526 } 12667 12527 if ((seq != NULL) && (seq != outSeq)) { 12668 12528 xmlXPathFreeNodeSet(seq); ··· 12718 12578 xmlXPathObjectPtr arg1, arg2; 12719 12579 12720 12580 CHECK_ERROR0; 12581 + if (OP_LIMIT_EXCEEDED(ctxt, 1)) 12582 + return(0); 12583 + if (ctxt->context->depth >= ctxt->context->maxDepth) 12584 + XP_ERROR0(XPATH_RECURSION_LIMIT_EXCEEDED); 12585 + ctxt->context->depth += 1; 12721 12586 comp = ctxt->comp; 12722 12587 switch (op->op) { 12723 12588 case XPATH_OP_END: 12724 - return (0); 12589 + break; 12725 12590 case XPATH_OP_UNION: 12726 12591 total = 12727 12592 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1], ··· 12735 12600 * limit tree traversing to first node in the result 12736 12601 */ 12737 12602 /* 12738 - * OPTIMIZE TODO: This implicitely sorts 12603 + * OPTIMIZE TODO: This implicitly sorts 12739 12604 * the result, even if not needed. E.g. if the argument 12740 12605 * of the count() function, no sorting is needed. 12741 12606 * OPTIMIZE TODO: How do we know if the node-list wasn't 12742 - * aready sorted? 12607 + * already sorted? 12743 12608 */ 12744 12609 if (ctxt->value->nodesetval->nodeNr > 1) 12745 12610 xmlXPathNodeSetSort(ctxt->value->nodesetval); ··· 12758 12623 xmlXPathReleaseObject(ctxt->context, arg2); 12759 12624 XP_ERROR0(XPATH_INVALID_TYPE); 12760 12625 } 12626 + if ((ctxt->context->opLimit != 0) && 12627 + (((arg1->nodesetval != NULL) && 12628 + (xmlXPathCheckOpLimit(ctxt, 12629 + arg1->nodesetval->nodeNr) < 0)) || 12630 + ((arg2->nodesetval != NULL) && 12631 + (xmlXPathCheckOpLimit(ctxt, 12632 + arg2->nodesetval->nodeNr) < 0)))) { 12633 + xmlXPathReleaseObject(ctxt->context, arg1); 12634 + xmlXPathReleaseObject(ctxt->context, arg2); 12635 + break; 12636 + } 12761 12637 12638 + /* TODO: Check memory error. */ 12762 12639 arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval, 12763 12640 arg2->nodesetval); 12764 12641 valuePush(ctxt, arg1); ··· 12766 12643 /* optimizer */ 12767 12644 if (total > cur) 12768 12645 xmlXPathCompSwap(op); 12769 - return (total + cur); 12646 + total += cur; 12647 + break; 12770 12648 case XPATH_OP_ROOT: 12771 12649 xmlXPathRoot(ctxt); 12772 - return (0); 12650 + break; 12773 12651 case XPATH_OP_NODE: 12774 12652 if (op->ch1 != -1) 12775 12653 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); ··· 12779 12657 CHECK_ERROR0; 12780 12658 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, 12781 12659 ctxt->context->node)); 12782 - return (total); 12660 + break; 12783 12661 case XPATH_OP_COLLECT:{ 12784 12662 if (op->ch1 == -1) 12785 - return (total); 12663 + break; 12786 12664 12787 12665 total = xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 12788 12666 CHECK_ERROR0; 12789 12667 12790 12668 total += xmlXPathNodeCollectAndTest(ctxt, op, first, NULL, 0); 12791 - return (total); 12669 + break; 12792 12670 } 12793 12671 case XPATH_OP_VALUE: 12794 12672 valuePush(ctxt, 12795 12673 xmlXPathCacheObjectCopy(ctxt->context, 12796 12674 (xmlXPathObjectPtr) op->value4)); 12797 - return (0); 12675 + break; 12798 12676 case XPATH_OP_SORT: 12799 12677 if (op->ch1 != -1) 12800 12678 total += ··· 12806 12684 && (ctxt->value->nodesetval != NULL) 12807 12685 && (ctxt->value->nodesetval->nodeNr > 1)) 12808 12686 xmlXPathNodeSetSort(ctxt->value->nodesetval); 12809 - return (total); 12687 + break; 12810 12688 #ifdef XP_OPTIMIZED_FILTER_FIRST 12811 12689 case XPATH_OP_FILTER: 12812 12690 total += xmlXPathCompOpEvalFilterFirst(ctxt, op, first); 12813 - return (total); 12691 + break; 12814 12692 #endif 12815 12693 default: 12816 - return (xmlXPathCompOpEval(ctxt, op)); 12694 + total += xmlXPathCompOpEval(ctxt, op); 12695 + break; 12817 12696 } 12697 + 12698 + ctxt->context->depth -= 1; 12699 + return(total); 12818 12700 } 12819 12701 12820 12702 /** ··· 12837 12719 xmlXPathObjectPtr arg1, arg2; 12838 12720 12839 12721 CHECK_ERROR0; 12722 + if (OP_LIMIT_EXCEEDED(ctxt, 1)) 12723 + return(0); 12724 + if (ctxt->context->depth >= ctxt->context->maxDepth) 12725 + XP_ERROR0(XPATH_RECURSION_LIMIT_EXCEEDED); 12726 + ctxt->context->depth += 1; 12840 12727 comp = ctxt->comp; 12841 12728 switch (op->op) { 12842 12729 case XPATH_OP_END: 12843 - return (0); 12730 + break; 12844 12731 case XPATH_OP_UNION: 12845 12732 total = 12846 12733 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], last); ··· 12876 12763 xmlXPathReleaseObject(ctxt->context, arg2); 12877 12764 XP_ERROR0(XPATH_INVALID_TYPE); 12878 12765 } 12766 + if ((ctxt->context->opLimit != 0) && 12767 + (((arg1->nodesetval != NULL) && 12768 + (xmlXPathCheckOpLimit(ctxt, 12769 + arg1->nodesetval->nodeNr) < 0)) || 12770 + ((arg2->nodesetval != NULL) && 12771 + (xmlXPathCheckOpLimit(ctxt, 12772 + arg2->nodesetval->nodeNr) < 0)))) { 12773 + xmlXPathReleaseObject(ctxt->context, arg1); 12774 + xmlXPathReleaseObject(ctxt->context, arg2); 12775 + break; 12776 + } 12879 12777 12778 + /* TODO: Check memory error. */ 12880 12779 arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval, 12881 12780 arg2->nodesetval); 12882 12781 valuePush(ctxt, arg1); ··· 12884 12783 /* optimizer */ 12885 12784 if (total > cur) 12886 12785 xmlXPathCompSwap(op); 12887 - return (total + cur); 12786 + total += cur; 12787 + break; 12888 12788 case XPATH_OP_ROOT: 12889 12789 xmlXPathRoot(ctxt); 12890 - return (0); 12790 + break; 12891 12791 case XPATH_OP_NODE: 12892 12792 if (op->ch1 != -1) 12893 12793 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); ··· 12897 12797 CHECK_ERROR0; 12898 12798 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, 12899 12799 ctxt->context->node)); 12900 - return (total); 12800 + break; 12901 12801 case XPATH_OP_COLLECT:{ 12902 12802 if (op->ch1 == -1) 12903 - return (0); 12803 + break; 12904 12804 12905 12805 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 12906 12806 CHECK_ERROR0; 12907 12807 12908 12808 total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, last, 0); 12909 - return (total); 12809 + break; 12910 12810 } 12911 12811 case XPATH_OP_VALUE: 12912 12812 valuePush(ctxt, 12913 12813 xmlXPathCacheObjectCopy(ctxt->context, 12914 12814 (xmlXPathObjectPtr) op->value4)); 12915 - return (0); 12815 + break; 12916 12816 case XPATH_OP_SORT: 12917 12817 if (op->ch1 != -1) 12918 12818 total += ··· 12924 12824 && (ctxt->value->nodesetval != NULL) 12925 12825 && (ctxt->value->nodesetval->nodeNr > 1)) 12926 12826 xmlXPathNodeSetSort(ctxt->value->nodesetval); 12927 - return (total); 12827 + break; 12928 12828 default: 12929 - return (xmlXPathCompOpEval(ctxt, op)); 12829 + total += xmlXPathCompOpEval(ctxt, op); 12830 + break; 12930 12831 } 12832 + 12833 + ctxt->context->depth -= 1; 12834 + return (total); 12931 12835 } 12932 12836 12933 12837 #ifdef XP_OPTIMIZED_FILTER_FIRST ··· 12937 12841 { 12938 12842 int total = 0; 12939 12843 xmlXPathCompExprPtr comp; 12940 - xmlXPathObjectPtr res; 12941 - xmlXPathObjectPtr obj; 12942 - xmlNodeSetPtr oldset; 12943 - xmlNodePtr oldnode; 12944 - xmlDocPtr oldDoc; 12945 - int oldcs, oldpp; 12946 - int i; 12844 + xmlNodeSetPtr set; 12947 12845 12948 12846 CHECK_ERROR0; 12949 12847 comp = ctxt->comp; ··· 12998 12896 * Hum are we filtering the result of an XPointer expression 12999 12897 */ 13000 12898 if (ctxt->value->type == XPATH_LOCATIONSET) { 13001 - xmlXPathObjectPtr tmp = NULL; 13002 - xmlLocationSetPtr newlocset = NULL; 13003 - xmlLocationSetPtr oldlocset; 13004 - 13005 - /* 13006 - * Extract the old locset, and then evaluate the result of the 13007 - * expression for all the element in the locset. use it to grow 13008 - * up a new locset. 13009 - */ 13010 - CHECK_TYPE0(XPATH_LOCATIONSET); 13011 - 13012 - if ((ctxt->value->user == NULL) || 13013 - (((xmlLocationSetPtr) ctxt->value->user)->locNr == 0)) 13014 - return (total); 12899 + xmlLocationSetPtr locset = ctxt->value->user; 13015 12900 13016 - obj = valuePop(ctxt); 13017 - oldlocset = obj->user; 13018 - oldnode = ctxt->context->node; 13019 - oldcs = ctxt->context->contextSize; 13020 - oldpp = ctxt->context->proximityPosition; 12901 + if (locset != NULL) { 12902 + xmlXPathLocationSetFilter(ctxt, locset, op->ch2, 1, 1); 12903 + if (locset->locNr > 0) 12904 + *first = (xmlNodePtr) locset->locTab[0]->user; 12905 + } 13021 12906 13022 - newlocset = xmlXPtrLocationSetCreate(NULL); 13023 - 13024 - for (i = 0; i < oldlocset->locNr; i++) { 13025 - /* 13026 - * Run the evaluation with a node list made of a 13027 - * single item in the nodelocset. 13028 - */ 13029 - ctxt->context->node = oldlocset->locTab[i]->user; 13030 - ctxt->context->contextSize = oldlocset->locNr; 13031 - ctxt->context->proximityPosition = i + 1; 13032 - if (tmp == NULL) { 13033 - tmp = xmlXPathCacheNewNodeSet(ctxt->context, 13034 - ctxt->context->node); 13035 - } else { 13036 - if (xmlXPathNodeSetAddUnique(tmp->nodesetval, 13037 - ctxt->context->node) < 0) { 13038 - ctxt->error = XPATH_MEMORY_ERROR; 13039 - } 13040 - } 13041 - valuePush(ctxt, tmp); 13042 - if (op->ch2 != -1) 13043 - total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); 13044 - if (ctxt->error != XPATH_EXPRESSION_OK) { 13045 - xmlXPtrFreeLocationSet(newlocset); 13046 - goto xptr_error; 13047 - } 13048 - /* 13049 - * The result of the evaluation need to be tested to 13050 - * decided whether the filter succeeded or not 13051 - */ 13052 - res = valuePop(ctxt); 13053 - if (xmlXPathEvaluatePredicateResult(ctxt, res)) { 13054 - xmlXPtrLocationSetAdd(newlocset, 13055 - xmlXPathCacheObjectCopy(ctxt->context, 13056 - oldlocset->locTab[i])); 13057 - } 13058 - /* 13059 - * Cleanup 13060 - */ 13061 - if (res != NULL) { 13062 - xmlXPathReleaseObject(ctxt->context, res); 13063 - } 13064 - if (ctxt->value == tmp) { 13065 - valuePop(ctxt); 13066 - xmlXPathNodeSetClear(tmp->nodesetval, 1); 13067 - /* 13068 - * REVISIT TODO: Don't create a temporary nodeset 13069 - * for everly iteration. 13070 - */ 13071 - /* OLD: xmlXPathFreeObject(res); */ 13072 - } else 13073 - tmp = NULL; 13074 - /* 13075 - * Only put the first node in the result, then leave. 13076 - */ 13077 - if (newlocset->locNr > 0) { 13078 - *first = (xmlNodePtr) oldlocset->locTab[i]->user; 13079 - break; 13080 - } 13081 - } 13082 - if (tmp != NULL) { 13083 - xmlXPathReleaseObject(ctxt->context, tmp); 13084 - } 13085 - /* 13086 - * The result is used as the new evaluation locset. 13087 - */ 13088 - valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset)); 13089 - xptr_error: 13090 - xmlXPathReleaseObject(ctxt->context, obj); 13091 - ctxt->context->node = oldnode; 13092 - ctxt->context->contextSize = oldcs; 13093 - ctxt->context->proximityPosition = oldpp; 13094 12907 return (total); 13095 12908 } 13096 12909 #endif /* LIBXML_XPTR_ENABLED */ 13097 12910 13098 - /* 13099 - * Extract the old set, and then evaluate the result of the 13100 - * expression for all the element in the set. use it to grow 13101 - * up a new set. 13102 - */ 13103 12911 CHECK_TYPE0(XPATH_NODESET); 13104 - 13105 - if ((ctxt->value->nodesetval != NULL) && 13106 - (ctxt->value->nodesetval->nodeNr != 0)) { 13107 - xmlNodeSetPtr newset; 13108 - xmlXPathObjectPtr tmp = NULL; 13109 - 13110 - obj = valuePop(ctxt); 13111 - oldset = obj->nodesetval; 13112 - oldnode = ctxt->context->node; 13113 - oldDoc = ctxt->context->doc; 13114 - oldcs = ctxt->context->contextSize; 13115 - oldpp = ctxt->context->proximityPosition; 13116 - 13117 - /* 13118 - * Initialize the new set. 13119 - * Also set the xpath document in case things like 13120 - * key() evaluation are attempted on the predicate 13121 - */ 13122 - newset = xmlXPathNodeSetCreate(NULL); 13123 - /* XXX what if xmlXPathNodeSetCreate returned NULL? */ 13124 - 13125 - for (i = 0; i < oldset->nodeNr; i++) { 13126 - /* 13127 - * Run the evaluation with a node list made of 13128 - * a single item in the nodeset. 13129 - */ 13130 - ctxt->context->node = oldset->nodeTab[i]; 13131 - if ((oldset->nodeTab[i]->type != XML_NAMESPACE_DECL) && 13132 - (oldset->nodeTab[i]->doc != NULL)) 13133 - ctxt->context->doc = oldset->nodeTab[i]->doc; 13134 - if (tmp == NULL) { 13135 - tmp = xmlXPathCacheNewNodeSet(ctxt->context, 13136 - ctxt->context->node); 13137 - } else { 13138 - if (xmlXPathNodeSetAddUnique(tmp->nodesetval, 13139 - ctxt->context->node) < 0) { 13140 - ctxt->error = XPATH_MEMORY_ERROR; 13141 - } 13142 - } 13143 - valuePush(ctxt, tmp); 13144 - ctxt->context->contextSize = oldset->nodeNr; 13145 - ctxt->context->proximityPosition = i + 1; 13146 - if (op->ch2 != -1) 13147 - total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); 13148 - if (ctxt->error != XPATH_EXPRESSION_OK) { 13149 - xmlXPathFreeNodeSet(newset); 13150 - goto error; 13151 - } 13152 - /* 13153 - * The result of the evaluation needs to be tested to 13154 - * decide whether the filter succeeded or not 13155 - */ 13156 - res = valuePop(ctxt); 13157 - if (xmlXPathEvaluatePredicateResult(ctxt, res)) { 13158 - if (xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]) < 0) 13159 - ctxt->error = XPATH_MEMORY_ERROR; 13160 - } 13161 - /* 13162 - * Cleanup 13163 - */ 13164 - if (res != NULL) { 13165 - xmlXPathReleaseObject(ctxt->context, res); 13166 - } 13167 - if (ctxt->value == tmp) { 13168 - valuePop(ctxt); 13169 - /* 13170 - * Don't free the temporary nodeset 13171 - * in order to avoid massive recreation inside this 13172 - * loop. 13173 - */ 13174 - xmlXPathNodeSetClear(tmp->nodesetval, 1); 13175 - } else 13176 - tmp = NULL; 13177 - /* 13178 - * Only put the first node in the result, then leave. 13179 - */ 13180 - if (newset->nodeNr > 0) { 13181 - *first = *(newset->nodeTab); 13182 - break; 13183 - } 13184 - } 13185 - if (tmp != NULL) { 13186 - xmlXPathReleaseObject(ctxt->context, tmp); 13187 - } 13188 - /* 13189 - * The result is used as the new evaluation set. 13190 - */ 13191 - valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, newset)); 13192 - error: 13193 - xmlXPathReleaseObject(ctxt->context, obj); 13194 - ctxt->context->node = oldnode; 13195 - ctxt->context->doc = oldDoc; 13196 - ctxt->context->contextSize = oldcs; 13197 - ctxt->context->proximityPosition = oldpp; 12912 + set = ctxt->value->nodesetval; 12913 + if (set != NULL) { 12914 + xmlXPathNodeSetFilter(ctxt, set, op->ch2, 1, 1, 1); 12915 + if (set->nodeNr > 0) 12916 + *first = set->nodeTab[0]; 13198 12917 } 13199 - return(total); 12918 + 12919 + return (total); 13200 12920 } 13201 12921 #endif /* XP_OPTIMIZED_FILTER_FIRST */ 13202 12922 ··· 13217 12937 xmlXPathObjectPtr arg1, arg2; 13218 12938 13219 12939 CHECK_ERROR0; 12940 + if (OP_LIMIT_EXCEEDED(ctxt, 1)) 12941 + return(0); 12942 + if (ctxt->context->depth >= ctxt->context->maxDepth) 12943 + XP_ERROR0(XPATH_RECURSION_LIMIT_EXCEEDED); 12944 + ctxt->context->depth += 1; 13220 12945 comp = ctxt->comp; 13221 12946 switch (op->op) { 13222 12947 case XPATH_OP_END: 13223 - return (0); 12948 + break; 13224 12949 case XPATH_OP_AND: 13225 12950 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13226 12951 CHECK_ERROR0; 13227 12952 xmlXPathBooleanFunction(ctxt, 1); 13228 12953 if ((ctxt->value == NULL) || (ctxt->value->boolval == 0)) 13229 - return (total); 12954 + break; 13230 12955 arg2 = valuePop(ctxt); 13231 12956 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); 13232 12957 if (ctxt->error) { 13233 12958 xmlXPathFreeObject(arg2); 13234 - return(0); 12959 + break; 13235 12960 } 13236 12961 xmlXPathBooleanFunction(ctxt, 1); 13237 12962 if (ctxt->value != NULL) 13238 12963 ctxt->value->boolval &= arg2->boolval; 13239 12964 xmlXPathReleaseObject(ctxt->context, arg2); 13240 - return (total); 12965 + break; 13241 12966 case XPATH_OP_OR: 13242 12967 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13243 12968 CHECK_ERROR0; 13244 12969 xmlXPathBooleanFunction(ctxt, 1); 13245 12970 if ((ctxt->value == NULL) || (ctxt->value->boolval == 1)) 13246 - return (total); 12971 + break; 13247 12972 arg2 = valuePop(ctxt); 13248 12973 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); 13249 12974 if (ctxt->error) { 13250 12975 xmlXPathFreeObject(arg2); 13251 - return(0); 12976 + break; 13252 12977 } 13253 12978 xmlXPathBooleanFunction(ctxt, 1); 13254 12979 if (ctxt->value != NULL) 13255 12980 ctxt->value->boolval |= arg2->boolval; 13256 12981 xmlXPathReleaseObject(ctxt->context, arg2); 13257 - return (total); 12982 + break; 13258 12983 case XPATH_OP_EQUAL: 13259 12984 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13260 12985 CHECK_ERROR0; ··· 13265 12990 else 13266 12991 equal = xmlXPathNotEqualValues(ctxt); 13267 12992 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, equal)); 13268 - return (total); 12993 + break; 13269 12994 case XPATH_OP_CMP: 13270 12995 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13271 12996 CHECK_ERROR0; ··· 13273 12998 CHECK_ERROR0; 13274 12999 ret = xmlXPathCompareValues(ctxt, op->value, op->value2); 13275 13000 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, ret)); 13276 - return (total); 13001 + break; 13277 13002 case XPATH_OP_PLUS: 13278 13003 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13279 13004 CHECK_ERROR0; ··· 13291 13016 CAST_TO_NUMBER; 13292 13017 CHECK_TYPE0(XPATH_NUMBER); 13293 13018 } 13294 - return (total); 13019 + break; 13295 13020 case XPATH_OP_MULT: 13296 13021 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13297 13022 CHECK_ERROR0; ··· 13303 13028 xmlXPathDivValues(ctxt); 13304 13029 else if (op->value == 2) 13305 13030 xmlXPathModValues(ctxt); 13306 - return (total); 13031 + break; 13307 13032 case XPATH_OP_UNION: 13308 13033 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13309 13034 CHECK_ERROR0; ··· 13318 13043 xmlXPathReleaseObject(ctxt->context, arg2); 13319 13044 XP_ERROR0(XPATH_INVALID_TYPE); 13320 13045 } 13046 + if ((ctxt->context->opLimit != 0) && 13047 + (((arg1->nodesetval != NULL) && 13048 + (xmlXPathCheckOpLimit(ctxt, 13049 + arg1->nodesetval->nodeNr) < 0)) || 13050 + ((arg2->nodesetval != NULL) && 13051 + (xmlXPathCheckOpLimit(ctxt, 13052 + arg2->nodesetval->nodeNr) < 0)))) { 13053 + xmlXPathReleaseObject(ctxt->context, arg1); 13054 + xmlXPathReleaseObject(ctxt->context, arg2); 13055 + break; 13056 + } 13321 13057 13322 13058 if ((arg1->nodesetval == NULL) || 13323 13059 ((arg2->nodesetval != NULL) && 13324 13060 (arg2->nodesetval->nodeNr != 0))) 13325 13061 { 13062 + /* TODO: Check memory error. */ 13326 13063 arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval, 13327 13064 arg2->nodesetval); 13328 13065 } 13329 13066 13330 13067 valuePush(ctxt, arg1); 13331 13068 xmlXPathReleaseObject(ctxt->context, arg2); 13332 - return (total); 13069 + break; 13333 13070 case XPATH_OP_ROOT: 13334 13071 xmlXPathRoot(ctxt); 13335 - return (total); 13072 + break; 13336 13073 case XPATH_OP_NODE: 13337 13074 if (op->ch1 != -1) 13338 13075 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); ··· 13342 13079 CHECK_ERROR0; 13343 13080 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, 13344 13081 ctxt->context->node)); 13345 - return (total); 13082 + break; 13346 13083 case XPATH_OP_COLLECT:{ 13347 13084 if (op->ch1 == -1) 13348 - return (total); 13085 + break; 13349 13086 13350 13087 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13351 13088 CHECK_ERROR0; 13352 13089 13353 13090 total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL, 0); 13354 - return (total); 13091 + break; 13355 13092 } 13356 13093 case XPATH_OP_VALUE: 13357 13094 valuePush(ctxt, 13358 13095 xmlXPathCacheObjectCopy(ctxt->context, 13359 13096 (xmlXPathObjectPtr) op->value4)); 13360 - return (total); 13097 + break; 13361 13098 case XPATH_OP_VARIABLE:{ 13362 13099 xmlXPathObjectPtr val; 13363 13100 ··· 13378 13115 "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n", 13379 13116 (char *) op->value4, (char *)op->value5); 13380 13117 ctxt->error = XPATH_UNDEF_PREFIX_ERROR; 13381 - return (total); 13118 + break; 13382 13119 } 13383 13120 val = xmlXPathVariableLookupNS(ctxt->context, 13384 13121 op->value4, URI); ··· 13386 13123 XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR); 13387 13124 valuePush(ctxt, val); 13388 13125 } 13389 - return (total); 13126 + break; 13390 13127 } 13391 13128 case XPATH_OP_FUNCTION:{ 13392 13129 xmlXPathFunction func; ··· 13400 13137 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13401 13138 if (ctxt->error != XPATH_EXPRESSION_OK) { 13402 13139 xmlXPathPopFrame(ctxt, frame); 13403 - return (total); 13140 + break; 13404 13141 } 13405 13142 } 13406 13143 if (ctxt->valueNr < ctxt->valueFrame + op->value) { ··· 13408 13145 "xmlXPathCompOpEval: parameter error\n"); 13409 13146 ctxt->error = XPATH_INVALID_OPERAND; 13410 13147 xmlXPathPopFrame(ctxt, frame); 13411 - return (total); 13148 + break; 13412 13149 } 13413 13150 for (i = 0; i < op->value; i++) { 13414 13151 if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) { ··· 13416 13153 "xmlXPathCompOpEval: parameter error\n"); 13417 13154 ctxt->error = XPATH_INVALID_OPERAND; 13418 13155 xmlXPathPopFrame(ctxt, frame); 13419 - return (total); 13156 + break; 13420 13157 } 13421 13158 } 13422 13159 if (op->cache != NULL) ··· 13436 13173 (char *)op->value4, (char *)op->value5); 13437 13174 xmlXPathPopFrame(ctxt, frame); 13438 13175 ctxt->error = XPATH_UNDEF_PREFIX_ERROR; 13439 - return (total); 13176 + break; 13440 13177 } 13441 13178 func = xmlXPathFunctionLookupNS(ctxt->context, 13442 13179 op->value4, URI); ··· 13457 13194 func(ctxt, op->value); 13458 13195 ctxt->context->function = oldFunc; 13459 13196 ctxt->context->functionURI = oldFuncURI; 13197 + if ((ctxt->error == XPATH_EXPRESSION_OK) && 13198 + (ctxt->valueNr != ctxt->valueFrame + 1)) 13199 + XP_ERROR0(XPATH_STACK_ERROR); 13460 13200 xmlXPathPopFrame(ctxt, frame); 13461 - return (total); 13201 + break; 13462 13202 } 13463 13203 case XPATH_OP_ARG: 13464 13204 if (op->ch1 != -1) { ··· 13469 13209 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); 13470 13210 CHECK_ERROR0; 13471 13211 } 13472 - return (total); 13212 + break; 13473 13213 case XPATH_OP_PREDICATE: 13474 13214 case XPATH_OP_FILTER:{ 13475 - xmlXPathObjectPtr res; 13476 - xmlXPathObjectPtr obj, tmp; 13477 - xmlNodeSetPtr newset = NULL; 13478 - xmlNodeSetPtr oldset; 13479 - xmlNodePtr oldnode; 13480 - xmlDocPtr oldDoc; 13481 - int oldcs, oldpp; 13482 - int i; 13215 + xmlNodeSetPtr set; 13483 13216 13484 13217 /* 13485 13218 * Optimization for ()[1] selection i.e. the first elem ··· 13491 13224 * will result in an ordered list if we have an 13492 13225 * XPATH_OP_FILTER? 13493 13226 * What about an additional field or flag on 13494 - * xmlXPathObject like @sorted ? This way we wouln'd need 13227 + * xmlXPathObject like @sorted ? This way we wouldn't need 13495 13228 * to assume anything, so it would be more robust and 13496 13229 * easier to optimize. 13497 13230 */ ··· 13523 13256 (ctxt->value->nodesetval->nodeNr > 1)) 13524 13257 xmlXPathNodeSetClearFromPos(ctxt->value->nodesetval, 13525 13258 1, 1); 13526 - return (total); 13259 + break; 13527 13260 } 13528 13261 } 13529 13262 /* ··· 13558 13291 (ctxt->value->nodesetval->nodeTab != NULL) && 13559 13292 (ctxt->value->nodesetval->nodeNr > 1)) 13560 13293 xmlXPathNodeSetKeepLast(ctxt->value->nodesetval); 13561 - return (total); 13294 + break; 13562 13295 } 13563 13296 } 13564 13297 /* ··· 13577 13310 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); 13578 13311 CHECK_ERROR0; 13579 13312 if (op->ch2 == -1) 13580 - return (total); 13313 + break; 13581 13314 if (ctxt->value == NULL) 13582 - return (total); 13315 + break; 13583 13316 13584 13317 #ifdef LIBXML_XPTR_ENABLED 13585 13318 /* 13586 13319 * Hum are we filtering the result of an XPointer expression 13587 13320 */ 13588 13321 if (ctxt->value->type == XPATH_LOCATIONSET) { 13589 - xmlLocationSetPtr newlocset = NULL; 13590 - xmlLocationSetPtr oldlocset; 13591 - 13592 - /* 13593 - * Extract the old locset, and then evaluate the result of the 13594 - * expression for all the element in the locset. use it to grow 13595 - * up a new locset. 13596 - */ 13597 - CHECK_TYPE0(XPATH_LOCATIONSET); 13598 - 13599 - if ((ctxt->value->user == NULL) || 13600 - (((xmlLocationSetPtr) ctxt->value->user)->locNr == 0)) 13601 - return (total); 13602 - 13603 - obj = valuePop(ctxt); 13604 - oldlocset = obj->user; 13605 - oldnode = ctxt->context->node; 13606 - oldcs = ctxt->context->contextSize; 13607 - oldpp = ctxt->context->proximityPosition; 13608 - 13609 - newlocset = xmlXPtrLocationSetCreate(NULL); 13610 - 13611 - for (i = 0; i < oldlocset->locNr; i++) { 13612 - /* 13613 - * Run the evaluation with a node list made of a 13614 - * single item in the nodelocset. 13615 - */ 13616 - ctxt->context->node = oldlocset->locTab[i]->user; 13617 - ctxt->context->contextSize = oldlocset->locNr; 13618 - ctxt->context->proximityPosition = i + 1; 13619 - tmp = xmlXPathCacheNewNodeSet(ctxt->context, 13620 - ctxt->context->node); 13621 - valuePush(ctxt, tmp); 13622 - 13623 - if (op->ch2 != -1) 13624 - total += 13625 - xmlXPathCompOpEval(ctxt, 13626 - &comp->steps[op->ch2]); 13627 - if (ctxt->error != XPATH_EXPRESSION_OK) { 13628 - xmlXPtrFreeLocationSet(newlocset); 13629 - goto filter_xptr_error; 13630 - } 13631 - 13632 - /* 13633 - * The result of the evaluation need to be tested to 13634 - * decided whether the filter succeeded or not 13635 - */ 13636 - res = valuePop(ctxt); 13637 - if (xmlXPathEvaluatePredicateResult(ctxt, res)) { 13638 - xmlXPtrLocationSetAdd(newlocset, 13639 - xmlXPathObjectCopy 13640 - (oldlocset->locTab[i])); 13641 - } 13642 - 13643 - /* 13644 - * Cleanup 13645 - */ 13646 - if (res != NULL) { 13647 - xmlXPathReleaseObject(ctxt->context, res); 13648 - } 13649 - if (ctxt->value == tmp) { 13650 - res = valuePop(ctxt); 13651 - xmlXPathReleaseObject(ctxt->context, res); 13652 - } 13653 - } 13654 - 13655 - /* 13656 - * The result is used as the new evaluation locset. 13657 - */ 13658 - valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset)); 13659 - filter_xptr_error: 13660 - xmlXPathReleaseObject(ctxt->context, obj); 13661 - ctxt->context->node = oldnode; 13662 - ctxt->context->contextSize = oldcs; 13663 - ctxt->context->proximityPosition = oldpp; 13664 - return (total); 13322 + xmlLocationSetPtr locset = ctxt->value->user; 13323 + xmlXPathLocationSetFilter(ctxt, locset, op->ch2, 13324 + 1, locset->locNr); 13325 + break; 13665 13326 } 13666 13327 #endif /* LIBXML_XPTR_ENABLED */ 13667 13328 13668 - /* 13669 - * Extract the old set, and then evaluate the result of the 13670 - * expression for all the element in the set. use it to grow 13671 - * up a new set. 13672 - */ 13673 13329 CHECK_TYPE0(XPATH_NODESET); 13674 - 13675 - if ((ctxt->value->nodesetval != NULL) && 13676 - (ctxt->value->nodesetval->nodeNr != 0)) { 13677 - obj = valuePop(ctxt); 13678 - oldset = obj->nodesetval; 13679 - oldnode = ctxt->context->node; 13680 - oldDoc = ctxt->context->doc; 13681 - oldcs = ctxt->context->contextSize; 13682 - oldpp = ctxt->context->proximityPosition; 13683 - tmp = NULL; 13684 - /* 13685 - * Initialize the new set. 13686 - * Also set the xpath document in case things like 13687 - * key() evaluation are attempted on the predicate 13688 - */ 13689 - newset = xmlXPathNodeSetCreate(NULL); 13690 - /* 13691 - * SPEC XPath 1.0: 13692 - * "For each node in the node-set to be filtered, the 13693 - * PredicateExpr is evaluated with that node as the 13694 - * context node, with the number of nodes in the 13695 - * node-set as the context size, and with the proximity 13696 - * position of the node in the node-set with respect to 13697 - * the axis as the context position;" 13698 - * @oldset is the node-set" to be filtered. 13699 - * 13700 - * SPEC XPath 1.0: 13701 - * "only predicates change the context position and 13702 - * context size (see [2.4 Predicates])." 13703 - * Example: 13704 - * node-set context pos 13705 - * nA 1 13706 - * nB 2 13707 - * nC 3 13708 - * After applying predicate [position() > 1] : 13709 - * node-set context pos 13710 - * nB 1 13711 - * nC 2 13712 - * 13713 - * removed the first node in the node-set, then 13714 - * the context position of the 13715 - */ 13716 - for (i = 0; i < oldset->nodeNr; i++) { 13717 - /* 13718 - * Run the evaluation with a node list made of 13719 - * a single item in the nodeset. 13720 - */ 13721 - ctxt->context->node = oldset->nodeTab[i]; 13722 - if ((oldset->nodeTab[i]->type != XML_NAMESPACE_DECL) && 13723 - (oldset->nodeTab[i]->doc != NULL)) 13724 - ctxt->context->doc = oldset->nodeTab[i]->doc; 13725 - if (tmp == NULL) { 13726 - tmp = xmlXPathCacheNewNodeSet(ctxt->context, 13727 - ctxt->context->node); 13728 - } else { 13729 - if (xmlXPathNodeSetAddUnique(tmp->nodesetval, 13730 - ctxt->context->node) < 0) { 13731 - ctxt->error = XPATH_MEMORY_ERROR; 13732 - } 13733 - } 13734 - valuePush(ctxt, tmp); 13735 - ctxt->context->contextSize = oldset->nodeNr; 13736 - ctxt->context->proximityPosition = i + 1; 13737 - /* 13738 - * Evaluate the predicate against the context node. 13739 - * Can/should we optimize position() predicates 13740 - * here (e.g. "[1]")? 13741 - */ 13742 - if (op->ch2 != -1) 13743 - total += 13744 - xmlXPathCompOpEval(ctxt, 13745 - &comp->steps[op->ch2]); 13746 - if (ctxt->error != XPATH_EXPRESSION_OK) { 13747 - xmlXPathFreeNodeSet(newset); 13748 - goto filter_error; 13749 - } 13750 - 13751 - /* 13752 - * The result of the evaluation needs to be tested to 13753 - * decide whether the filter succeeded or not 13754 - */ 13755 - /* 13756 - * OPTIMIZE TODO: Can we use 13757 - * xmlXPathNodeSetAdd*Unique()* instead? 13758 - */ 13759 - res = valuePop(ctxt); 13760 - if (xmlXPathEvaluatePredicateResult(ctxt, res)) { 13761 - if (xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]) 13762 - < 0) 13763 - ctxt->error = XPATH_MEMORY_ERROR; 13764 - } 13765 - 13766 - /* 13767 - * Cleanup 13768 - */ 13769 - if (res != NULL) { 13770 - xmlXPathReleaseObject(ctxt->context, res); 13771 - } 13772 - if (ctxt->value == tmp) { 13773 - valuePop(ctxt); 13774 - xmlXPathNodeSetClear(tmp->nodesetval, 1); 13775 - /* 13776 - * Don't free the temporary nodeset 13777 - * in order to avoid massive recreation inside this 13778 - * loop. 13779 - */ 13780 - } else 13781 - tmp = NULL; 13782 - } 13783 - if (tmp != NULL) 13784 - xmlXPathReleaseObject(ctxt->context, tmp); 13785 - /* 13786 - * The result is used as the new evaluation set. 13787 - */ 13788 - valuePush(ctxt, 13789 - xmlXPathCacheWrapNodeSet(ctxt->context, newset)); 13790 - filter_error: 13791 - xmlXPathReleaseObject(ctxt->context, obj); 13792 - ctxt->context->node = oldnode; 13793 - ctxt->context->doc = oldDoc; 13794 - ctxt->context->contextSize = oldcs; 13795 - ctxt->context->proximityPosition = oldpp; 13796 - } 13797 - return (total); 13330 + set = ctxt->value->nodesetval; 13331 + if (set != NULL) 13332 + xmlXPathNodeSetFilter(ctxt, set, op->ch2, 13333 + 1, set->nodeNr, 1); 13334 + break; 13798 13335 } 13799 13336 case XPATH_OP_SORT: 13800 13337 if (op->ch1 != -1) ··· 13807 13344 { 13808 13345 xmlXPathNodeSetSort(ctxt->value->nodesetval); 13809 13346 } 13810 - return (total); 13347 + break; 13811 13348 #ifdef LIBXML_XPTR_ENABLED 13812 13349 case XPATH_OP_RANGETO:{ 13813 13350 xmlXPathObjectPtr range; ··· 13830 13367 XP_ERROR0(XPATH_INVALID_OPERAND); 13831 13368 } 13832 13369 if (op->ch2 == -1) 13833 - return (total); 13370 + break; 13834 13371 13835 13372 if (ctxt->value->type == XPATH_LOCATIONSET) { 13836 13373 /* ··· 13842 13379 13843 13380 if ((ctxt->value->user == NULL) || 13844 13381 (((xmlLocationSetPtr) ctxt->value->user)->locNr == 0)) 13845 - return (total); 13382 + break; 13846 13383 13847 13384 obj = valuePop(ctxt); 13848 13385 oldlocset = obj->user; ··· 13964 13501 ctxt->context->node = oldnode; 13965 13502 ctxt->context->contextSize = oldcs; 13966 13503 ctxt->context->proximityPosition = oldpp; 13967 - return (total); 13504 + break; 13968 13505 } 13969 13506 #endif /* LIBXML_XPTR_ENABLED */ 13507 + default: 13508 + xmlGenericError(xmlGenericErrorContext, 13509 + "XPath: unknown precompiled operation %d\n", op->op); 13510 + ctxt->error = XPATH_INVALID_OPERAND; 13511 + break; 13970 13512 } 13971 - xmlGenericError(xmlGenericErrorContext, 13972 - "XPath: unknown precompiled operation %d\n", op->op); 13973 - ctxt->error = XPATH_INVALID_OPERAND; 13513 + 13514 + ctxt->context->depth -= 1; 13974 13515 return (total); 13975 13516 } 13976 13517 ··· 13990 13531 xmlXPathObjectPtr resObj = NULL; 13991 13532 13992 13533 start: 13534 + if (OP_LIMIT_EXCEEDED(ctxt, 1)) 13535 + return(0); 13993 13536 /* comp = ctxt->comp; */ 13994 13537 switch (op->op) { 13995 13538 case XPATH_OP_END: ··· 14116 13659 /* Select "/" */ 14117 13660 if (toBool) 14118 13661 return(1); 13662 + /* TODO: Check memory error. */ 14119 13663 xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, 14120 13664 (xmlNodePtr) ctxt->doc); 14121 13665 } else { 14122 13666 /* Select "self::node()" */ 14123 13667 if (toBool) 14124 13668 return(1); 13669 + /* TODO: Check memory error. */ 14125 13670 xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, ctxt->node); 14126 13671 } 14127 13672 } ··· 14182 13727 } else if (ret == 1) { 14183 13728 if (toBool) 14184 13729 goto return_1; 13730 + /* TODO: Check memory error. */ 14185 13731 xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, cur); 14186 13732 } 14187 13733 } ··· 14189 13735 goto scan_children; 14190 13736 next_node: 14191 13737 do { 13738 + if (ctxt->opLimit != 0) { 13739 + if (ctxt->opCount >= ctxt->opLimit) { 13740 + xmlGenericError(xmlGenericErrorContext, 13741 + "XPath operation limit exceeded\n"); 13742 + xmlFreeStreamCtxt(patstream); 13743 + return(-1); 13744 + } 13745 + ctxt->opCount++; 13746 + } 13747 + 14192 13748 nb_nodes++; 14193 13749 14194 13750 switch (cur->type) { ··· 14311 13867 14312 13868 if ((ctxt == NULL) || (ctxt->comp == NULL)) 14313 13869 return(-1); 13870 + 13871 + ctxt->context->depth = 0; 14314 13872 14315 13873 if (ctxt->valueTab == NULL) { 14316 13874 /* Allocate the value stack */ ··· 14498 14056 14499 14057 /* 14500 14058 * We don't try to handle expressions using the verbose axis 14501 - * specifiers ("::"), just the simplied form at this point. 14059 + * specifiers ("::"), just the simplified form at this point. 14502 14060 * Additionally, if there is no list of namespaces available and 14503 14061 * there's a ":" in the expression, indicating a prefixed QName, 14504 14062 * then we won't try to compile either. xmlPatterncompile() needs ··· 14552 14110 #endif /* XPATH_STREAMING */ 14553 14111 14554 14112 static void 14555 - xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) 14113 + xmlXPathOptimizeExpression(xmlXPathParserContextPtr pctxt, 14114 + xmlXPathStepOpPtr op) 14556 14115 { 14116 + xmlXPathCompExprPtr comp = pctxt->comp; 14117 + xmlXPathContextPtr ctxt; 14118 + 14557 14119 /* 14558 14120 * Try to rewrite "descendant-or-self::node()/foo" to an optimized 14559 14121 * internal representation. ··· 14609 14171 return; 14610 14172 14611 14173 /* Recurse */ 14174 + ctxt = pctxt->context; 14175 + if (ctxt != NULL) { 14176 + if (ctxt->depth >= ctxt->maxDepth) 14177 + return; 14178 + ctxt->depth += 1; 14179 + } 14612 14180 if (op->ch1 != -1) 14613 - xmlXPathOptimizeExpression(comp, &comp->steps[op->ch1]); 14181 + xmlXPathOptimizeExpression(pctxt, &comp->steps[op->ch1]); 14614 14182 if (op->ch2 != -1) 14615 - xmlXPathOptimizeExpression(comp, &comp->steps[op->ch2]); 14183 + xmlXPathOptimizeExpression(pctxt, &comp->steps[op->ch2]); 14184 + if (ctxt != NULL) 14185 + ctxt->depth -= 1; 14616 14186 } 14617 14187 14618 14188 /** ··· 14641 14211 pctxt = xmlXPathNewParserContext(str, ctxt); 14642 14212 if (pctxt == NULL) 14643 14213 return NULL; 14214 + if (ctxt != NULL) 14215 + ctxt->depth = 0; 14644 14216 xmlXPathCompileExpr(pctxt, 1); 14645 14217 14646 14218 if( pctxt->error != XPATH_EXPRESSION_OK ) ··· 14660 14232 comp = NULL; 14661 14233 } else { 14662 14234 comp = pctxt->comp; 14235 + if ((comp->nbStep > 1) && (comp->last >= 0)) { 14236 + if (ctxt != NULL) 14237 + ctxt->depth = 0; 14238 + xmlXPathOptimizeExpression(pctxt, &comp->steps[comp->last]); 14239 + } 14663 14240 pctxt->comp = NULL; 14664 14241 } 14665 14242 xmlXPathFreeParserContext(pctxt); ··· 14670 14247 comp->string = xmlStrdup(str); 14671 14248 comp->nb = 0; 14672 14249 #endif 14673 - if ((comp->nbStep > 1) && (comp->last >= 0)) { 14674 - xmlXPathOptimizeExpression(comp, &comp->steps[comp->last]); 14675 - } 14676 14250 } 14677 14251 return(comp); 14678 14252 } ··· 14829 14403 } else 14830 14404 #endif 14831 14405 { 14406 + if (ctxt->context != NULL) 14407 + ctxt->context->depth = 0; 14832 14408 xmlXPathCompileExpr(ctxt, 1); 14833 14409 CHECK_ERROR; 14834 14410 ··· 14836 14412 if (*ctxt->cur != 0) 14837 14413 XP_ERROR(XPATH_EXPR_ERROR); 14838 14414 14839 - if ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0)) 14840 - xmlXPathOptimizeExpression(ctxt->comp, 14415 + if ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0)) { 14416 + if (ctxt->context != NULL) 14417 + ctxt->context->depth = 0; 14418 + xmlXPathOptimizeExpression(ctxt, 14841 14419 &ctxt->comp->steps[ctxt->comp->last]); 14420 + } 14842 14421 } 14843 14422 14844 14423 xmlXPathRunEval(ctxt, 0);
+14 -4
sdk/lib/3rdparty/libxml2/xpointer.c
··· 27 27 * be parsed beforehand instead of a progressive evaluation 28 28 * TODO: Access into entities references are not supported now ... 29 29 * need a start to be able to pop out of entities refs since 30 - * parent is the endity declaration, not the ref. 30 + * parent is the entity declaration, not the ref. 31 31 */ 32 32 33 33 #include <string.h> ··· 1186 1186 static void 1187 1187 xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) { 1188 1188 /* 1189 - * XPointer don't allow by syntax to address in mutirooted trees 1189 + * XPointer don't allow by syntax to address in multirooted trees 1190 1190 * this might prove useful in some cases, warn about it. 1191 1191 */ 1192 1192 if ((name == NULL) && (CUR == '/') && (NXT(1) != '1')) { ··· 1202 1202 } 1203 1203 1204 1204 while (CUR == '/') { 1205 - int child = 0; 1205 + int child = 0, overflow = 0; 1206 1206 NEXT; 1207 1207 1208 1208 while ((CUR >= '0') && (CUR <= '9')) { 1209 - child = child * 10 + (CUR - '0'); 1209 + int d = CUR - '0'; 1210 + if (child > INT_MAX / 10) 1211 + overflow = 1; 1212 + else 1213 + child *= 10; 1214 + if (child > INT_MAX - d) 1215 + overflow = 1; 1216 + else 1217 + child += d; 1210 1218 NEXT; 1211 1219 } 1220 + if (overflow) 1221 + child = 0; 1212 1222 xmlXPtrGetChildNo(ctxt, child); 1213 1223 } 1214 1224 }
+2 -2
sdk/lib/3rdparty/libxml2/xzlib.c
··· 1 1 /** 2 - * xzlib.c: front end for the transparent suport of lzma compression 2 + * xzlib.c: front end for the transparent support of lzma compression 3 3 * at the I/O layer, based on an example file from lzma project 4 4 * 5 5 * See Copyright for the status of this software. ··· 71 71 int err; /* error code */ 72 72 char *msg; /* error message */ 73 73 /* lzma stream */ 74 - int init; /* is the iniflate stream initialized */ 74 + int init; /* is the inflate stream initialized */ 75 75 lzma_stream strm; /* stream structure in-place (not a pointer) */ 76 76 char padding1[32]; /* padding allowing to cope with possible 77 77 extensions of above structure without
+1 -1
sdk/lib/3rdparty/libxml2/xzlib.h
··· 1 1 /** 2 - * xzlib.h: header for the front end for the transparent suport of lzma 2 + * xzlib.h: header for the front end for the transparent support of lzma 3 3 * compression at the I/O layer 4 4 * 5 5 * See Copyright for the status of this software.