60#define XML_BUILDING_EXPAT 1
64#if ! defined(_GNU_SOURCE)
70# if ! defined(_CRT_RAND_S)
85# define getpid GetCurrentProcessId
88# include <sys/types.h>
102#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
103# if defined(HAVE_GETRANDOM)
104# include <sys/random.h>
107# include <sys/syscall.h>
109# if ! defined(GRND_NONBLOCK)
110# define GRND_NONBLOCK 0x0001
114#if defined(HAVE_LIBBSD) \
115 && (defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_ARC4RANDOM))
116# include <bsd/stdlib.h>
119#if defined(_WIN32) && ! defined(LOAD_LIBRARY_SEARCH_SYSTEM32)
120# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
123#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \
124 && ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \
125 && ! defined(XML_DEV_URANDOM) && ! defined(_WIN32) \
126 && ! defined(XML_POOR_ENTROPY)
127# error You do not have support for any sources of high quality entropy \
128 enabled. For end user security, that is probably not what you want. \
130 Your options include: \
131 * Linux >=3.17 + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \
132 * Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
133 * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \
134 * BSD / macOS (including <10.7) (arc4random): HAVE_ARC4RANDOM, \
135 * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \
136 * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, \
137 * Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \
138 * Windows >=Vista (rand_s): _WIN32. \
140 If insist on not using any of these, bypass this error by defining \
141 XML_POOR_ENTROPY; you have been warned. \
143 If you have reasons to patch this detection code away or need changes \
144 to the build system, please open a bug. Thank you!
148# define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
149# define XmlConvert XmlUtf16Convert
150# define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
151# define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
152# define XmlEncode XmlUtf16Encode
153# define MUST_CONVERT(enc, s) (! (enc)->isUtf16 || (((uintptr_t)(s)) & 1))
154typedef unsigned short ICHAR;
156# define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
157# define XmlConvert XmlUtf8Convert
158# define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
159# define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
160# define XmlEncode XmlUtf8Encode
161# define MUST_CONVERT(enc, s) (! (enc)->isUtf8)
167# define XmlInitEncodingNS XmlInitEncoding
168# define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
169# undef XmlGetInternalEncodingNS
170# define XmlGetInternalEncodingNS XmlGetInternalEncoding
171# define XmlParseXmlDeclNS XmlParseXmlDecl
177# ifdef XML_UNICODE_WCHAR_T
178# define XML_T(x) (const wchar_t) x
179# define XML_L(x) L##x
181# define XML_T(x) (const unsigned short)x
193#define ROUND_UP(n, sz) (((n) + ((sz)-1)) & ~((sz)-1))
196#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)
216static size_t keylen(
KEY s);
228#define SECOND_HASH(hash, mask, power) \
229 ((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2))
230#define PROBE_STEP(hash, mask, power) \
231 ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
238#define INIT_TAG_BUF_SIZE 32
239#define INIT_DATA_BUF_SIZE 1024
240#define INIT_ATTS_SIZE 16
241#define INIT_ATTS_VERSION 0xFFFFFFFF
242#define INIT_BLOCK_SIZE 1024
243#define INIT_BUFFER_SIZE 1024
245#define EXPAND_SPARE 24
318#define INIT_SCAFFOLD_ELEMENTS 32
429 const char *end,
const char **endPtr);
438static Processor externalParEntInitProcessor;
440static Processor entityValueInitProcessor;
444static Processor externalEntityInitProcessor;
445static Processor externalEntityInitProcessor2;
446static Processor externalEntityInitProcessor3;
447static Processor externalEntityContentProcessor;
453 const char *s,
const char *next);
456 const char *s,
const char *end,
int tok,
457 const char *next,
const char **nextPtr,
463 const ENCODING *enc,
const char *start,
464 const char *end,
const char **endPtr,
467 const char **startPtr,
const char *end,
468 const char **nextPtr,
XML_Bool haveMore,
472 const char **startPtr,
const char *end,
473 const char **nextPtr,
XML_Bool haveMore);
478 const char *s,
TAG_NAME *tagNamePtr,
496 const char *start,
const char *end);
499 const char *start,
const char *end,
502 const char *start,
const char *end);
504 const char *start,
const char *end);
506 const char *start,
const char *end);
516static void dtdDestroy(
DTD *p,
XML_Bool isDocEntity,
536 const char *ptr,
const char *end);
538 const char *ptr,
const char *end);
550 const char *ptr,
const char *end);
555static unsigned long generate_hash_secret_salt(
XML_Parser parser);
565static float accountingGetCurrentAmplification(
XML_Parser rootParser);
566static void accountingReportStats(
XML_Parser originParser,
const char *epilog);
567static void accountingOnAbort(
XML_Parser originParser);
568static void accountingReportDiff(
XML_Parser rootParser,
569 unsigned int levelsAwayFromRootParser,
570 const char *before,
const char *after,
571 ptrdiff_t bytesMore,
int source_line,
574 const char *before,
const char *after,
579 const char *action,
int sourceLine);
586 unsigned int *outLevelDiff);
589static unsigned long getDebugLevel(
const char *variableName,
590 unsigned long defaultDebugLevel);
592#define poolStart(pool) ((pool)->start)
593#define poolEnd(pool) ((pool)->ptr)
594#define poolLength(pool) ((pool)->ptr - (pool)->start)
595#define poolChop(pool) ((void)--(pool->ptr))
596#define poolLastChar(pool) (((pool)->ptr)[-1])
597#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
598#define poolFinish(pool) ((pool)->start = (pool)->ptr)
599#define poolAppendChar(pool, c) \
600 (((pool)->ptr == (pool)->end && ! poolGrow(pool)) \
602 : ((*((pool)->ptr)++ = c), 1))
689 XML_AttrInfo *m_attInfo;
711#define MALLOC(parser, s) (parser->m_mem.malloc_fcn((s)))
712#define REALLOC(parser, p, s) (parser->m_mem.realloc_fcn((p), (s)))
713#define FREE(parser, p) (parser->m_mem.free_fcn((p)))
727static const XML_Char implicitContext[]
739#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
741# if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
745writeRandomBytes_getrandom_nonblock(
void *target,
size_t count) {
747 size_t bytesWrittenTotal = 0;
748 const unsigned int getrandomFlags = GRND_NONBLOCK;
751 void *
const currentTarget = (
void *)((
char *)target + bytesWrittenTotal);
752 const size_t bytesToWrite = count - bytesWrittenTotal;
754 const int bytesWrittenMore =
755# if defined(HAVE_GETRANDOM)
756 getrandom(currentTarget, bytesToWrite, getrandomFlags);
758 syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags);
761 if (bytesWrittenMore > 0) {
762 bytesWrittenTotal += bytesWrittenMore;
763 if (bytesWrittenTotal >= count)
766 }
while (! success && (errno == EINTR));
773# if ! defined(_WIN32) && defined(XML_DEV_URANDOM)
777writeRandomBytes_dev_urandom(
void *target,
size_t count) {
779 size_t bytesWrittenTotal = 0;
781 const int fd = open(
"/dev/urandom", O_RDONLY);
787 void *
const currentTarget = (
void *)((
char *)target + bytesWrittenTotal);
788 const size_t bytesToWrite = count - bytesWrittenTotal;
790 const ssize_t bytesWrittenMore = read(fd, currentTarget, bytesToWrite);
792 if (bytesWrittenMore > 0) {
793 bytesWrittenTotal += bytesWrittenMore;
794 if (bytesWrittenTotal >= count)
797 }
while (! success && (errno == EINTR));
807#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
810writeRandomBytes_arc4random(
void *target,
size_t count) {
811 size_t bytesWrittenTotal = 0;
813 while (bytesWrittenTotal < count) {
814 const uint32_t random32 = arc4random();
817 for (; (i <
sizeof(random32)) && (bytesWrittenTotal < count);
818 i++, bytesWrittenTotal++) {
819 const uint8_t random8 = (uint8_t)(random32 >> (i * 8));
820 ((uint8_t *)target)[bytesWrittenTotal] = random8;
833# if defined(__MINGW32__) && defined(__MINGW32_VERSION) \
834 && __MINGW32_VERSION < 5003000L && ! defined(__MINGW64_VERSION_MAJOR)
835__declspec(dllimport)
int rand_s(
unsigned int *);
843writeRandomBytes_rand_s(
void *target,
size_t count) {
844 size_t bytesWrittenTotal = 0;
846 while (bytesWrittenTotal < count) {
847 unsigned int random32 = 0;
850 if (rand_s(&random32))
853 for (; (i <
sizeof(random32)) && (bytesWrittenTotal < count);
854 i++, bytesWrittenTotal++) {
855 const uint8_t random8 = (uint8_t)(random32 >> (i * 8));
856 ((uint8_t *)target)[bytesWrittenTotal] = random8;
864#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
867gather_time_entropy(
void) {
870 GetSystemTimeAsFileTime(&ft);
871 return ft.dwHighDateTime ^ ft.dwLowDateTime;
874 int gettimeofday_res;
876 gettimeofday_res = gettimeofday(&tv, NULL);
879 (void)gettimeofday_res;
881 assert(gettimeofday_res == 0);
892ENTROPY_DEBUG(
const char *label,
unsigned long entropy) {
893 if (getDebugLevel(
"EXPAT_ENTROPY_DEBUG", 0) >= 1u) {
894 fprintf(stderr,
"expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n", label,
895 (
int)
sizeof(entropy) * 2, entropy, (
unsigned long)
sizeof(entropy));
902 unsigned long entropy;
906#if defined(HAVE_ARC4RANDOM_BUF)
907 arc4random_buf(&entropy,
sizeof(entropy));
908 return ENTROPY_DEBUG(
"arc4random_buf", entropy);
909#elif defined(HAVE_ARC4RANDOM)
910 writeRandomBytes_arc4random((
void *)&entropy,
sizeof(entropy));
911 return ENTROPY_DEBUG(
"arc4random", entropy);
915 if (writeRandomBytes_rand_s((
void *)&entropy,
sizeof(entropy))) {
916 return ENTROPY_DEBUG(
"rand_s", entropy);
918# elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
919 if (writeRandomBytes_getrandom_nonblock((
void *)&entropy,
sizeof(entropy))) {
920 return ENTROPY_DEBUG(
"getrandom", entropy);
923# if ! defined(_WIN32) && defined(XML_DEV_URANDOM)
924 if (writeRandomBytes_dev_urandom((
void *)&entropy,
sizeof(entropy))) {
925 return ENTROPY_DEBUG(
"/dev/urandom", entropy);
931 entropy = gather_time_entropy() ^ getpid();
934 if (
sizeof(
unsigned long) == 4) {
935 return ENTROPY_DEBUG(
"fallback(4)", entropy * 2147483647);
937 return ENTROPY_DEBUG(
"fallback(8)",
938 entropy * (
unsigned long)2305843009213693951ULL);
959 return setContext(parser, implicitContext);
968 return parserCreate(encodingName, memsuite, nameSep, NULL);
972parserCreate(
const XML_Char *encodingName,
980 if (parser != NULL) {
989 if (parser != NULL) {
1006 if (parser->
m_atts == NULL) {
1007 FREE(parser, parser);
1011 parser->m_attInfo = (XML_AttrInfo *)
MALLOC(
1012 parser, parser->
m_attsSize *
sizeof(XML_AttrInfo));
1013 if (parser->m_attInfo == NULL) {
1015 FREE(parser, parser);
1024 FREE(parser, parser->m_attInfo);
1026 FREE(parser, parser);
1032 parser->
m_dtd = dtd;
1035 if (parser->
m_dtd == NULL) {
1039 FREE(parser, parser->m_attInfo);
1041 FREE(parser, parser);
1068 parserInit(parser, encodingName);
1090 if (encodingName != NULL) {
1146 parser->m_unknownEncodingRelease = NULL;
1203 while (openEntityList) {
1205 openEntityList = openEntity->
next;
1211 if (parser->m_unknownEncodingRelease)
1217 parserInit(parser, encodingName);
1237 if (encodingName == NULL)
1278 void *oldHandlerArg;
1279 XML_Bool oldDefaultExpandInternalEntities;
1283 int oldInEntityValue;
1291 unsigned long oldhash_secret_salt;
1294 if (oldParser == NULL)
1298 oldDtd = parser->
m_dtd;
1349 parser = parserCreate(encodingName, &parser->
m_mem, tmp, newDtd);
1351 parser = parserCreate(encodingName, &parser->
m_mem, NULL, newDtd);
1379 if (oldUserData == oldHandlerArg)
1383 if (oldExternalEntityRefHandlerArg != oldParser)
1394 if (! dtdCopy(oldParser, parser->
m_dtd, oldDtd, &parser->
m_mem)
1395 || ! setContext(parser, context)) {
1399 parser->
m_processor = externalEntityInitProcessor;
1411 parser->
m_processor = externalParEntInitProcessor;
1439 if (tagList == NULL) {
1446 tagList = tagList->
parent;
1448 destroyBindings(p->
bindings, parser);
1455 if (entityList == NULL) {
1461 openEntity = entityList;
1462 entityList = entityList->
next;
1463 FREE(parser, openEntity);
1483 FREE(parser, (
void *)parser->m_attInfo);
1490 if (parser->m_unknownEncodingRelease)
1492 FREE(parser, parser);
1544 p = poolCopyString(&parser->
m_dtd->
pool, p);
1579 return parser->m_attInfo;
1820 if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) {
1889#ifndef XML_CONTEXT_BYTES
1931 nLeftOver = s + len - end;
1937 const int bytesToAllocate = (int)((
unsigned)len * 2U);
1938 if (bytesToAllocate > 0) {
1950 memcpy(parser->
m_buffer, end, nLeftOver);
1966 memcpy(buff, s, len);
2056#ifdef XML_CONTEXT_BYTES
2060 int neededSize = (int)((
unsigned)len
2063 if (neededSize < 0) {
2067#ifdef XML_CONTEXT_BYTES
2072 if (keep >
INT_MAX - neededSize) {
2080#ifdef XML_CONTEXT_BYTES
2106 if (bufferSize == 0)
2110 bufferSize = (int)(2U * (
unsigned)bufferSize);
2111 }
while (bufferSize < neededSize && bufferSize > 0);
2112 if (bufferSize <= 0) {
2116 newBuf = (
char *)
MALLOC(parser, bufferSize);
2122#ifdef XML_CONTEXT_BYTES
2234 assert(status != NULL);
2266#ifdef XML_CONTEXT_BYTES
2281 return (
const char *)0;
2311 FREE(parser, model);
2318 return MALLOC(parser, size);
2325 return REALLOC(parser, ptr, size);
2355 return XML_L(
"out of memory");
2357 return XML_L(
"syntax error");
2359 return XML_L(
"no element found");
2361 return XML_L(
"not well-formed (invalid token)");
2363 return XML_L(
"unclosed token");
2365 return XML_L(
"partial character");
2367 return XML_L(
"mismatched tag");
2369 return XML_L(
"duplicate attribute");
2371 return XML_L(
"junk after document element");
2373 return XML_L(
"illegal parameter entity reference");
2375 return XML_L(
"undefined entity");
2377 return XML_L(
"recursive entity reference");
2379 return XML_L(
"asynchronous entity");
2381 return XML_L(
"reference to invalid character number");
2383 return XML_L(
"reference to binary entity");
2385 return XML_L(
"reference to external entity in attribute");
2387 return XML_L(
"XML or text declaration not at start of entity");
2389 return XML_L(
"unknown encoding");
2391 return XML_L(
"encoding specified in XML declaration is incorrect");
2393 return XML_L(
"unclosed CDATA section");
2395 return XML_L(
"error in processing external entity reference");
2397 return XML_L(
"document is not standalone");
2399 return XML_L(
"unexpected parser state - please send a bug report");
2401 return XML_L(
"entity declared in parameter entity");
2403 return XML_L(
"requested feature requires XML_DTD support in Expat");
2405 return XML_L(
"cannot change setting once parsing has begun");
2408 return XML_L(
"unbound prefix");
2411 return XML_L(
"must not undeclare prefix");
2413 return XML_L(
"incomplete markup in parameter entity");
2415 return XML_L(
"XML declaration not well-formed");
2417 return XML_L(
"text declaration not well-formed");
2419 return XML_L(
"illegal character(s) in public id");
2421 return XML_L(
"parser suspended");
2423 return XML_L(
"parser not suspended");
2425 return XML_L(
"parsing aborted");
2427 return XML_L(
"parsing finished");
2429 return XML_L(
"cannot suspend in external parameter entity");
2433 "reserved prefix (xml) must not be undeclared or bound to another namespace name");
2435 return XML_L(
"reserved prefix (xmlns) must not be declared or undeclared");
2438 "prefix must not be bound to one of the reserved namespace names");
2441 return XML_L(
"invalid argument");
2445 "a successful prior call to function XML_GetBuffer is required");
2449 "limit on input amplification factor (from DTD and entities) breached");
2464#define V1(a, b, c) XML_L(#a) XML_L(".") XML_L(#b) XML_L(".") XML_L(#c)
2465#define V2(a, b, c) XML_L("expat_") V1(a, b, c)
2494#ifdef XML_UNICODE_WCHAR_T
2500#ifdef XML_CONTEXT_BYTES
2510#ifdef XML_LARGE_SIZE
2519 XML_L(
"XML_BLAP_MAX_AMP"),
2523 XML_L(
"XML_BLAP_ACT_THRES"),
2534 XML_Parser parser,
float maximumAmplificationFactor) {
2536 || isnan(maximumAmplificationFactor)
2537 || (maximumAmplificationFactor < 1.0f)) {
2546 XML_Parser parser,
unsigned long long activationThresholdBytes) {
2567 char *rawNameBuf =
tag->
buf + nameLen;
2580 if (rawNameLen > (
size_t)
INT_MAX - nameLen)
2582 bufSize = nameLen + (int)rawNameLen;
2600 rawNameBuf = temp + nameLen;
2610contentProcessor(
XML_Parser parser,
const char *start,
const char *end,
2611 const char **endPtr) {
2613 parser, 0, parser->
m_encoding, start, end, endPtr,
2616 if (! storeRawNames(parser))
2623externalEntityInitProcessor(
XML_Parser parser,
const char *start,
2624 const char *end,
const char **endPtr) {
2625 enum XML_Error result = initializeEncoding(parser);
2628 parser->
m_processor = externalEntityInitProcessor2;
2629 return externalEntityInitProcessor2(parser, start, end, endPtr);
2633externalEntityInitProcessor2(
XML_Parser parser,
const char *start,
2634 const char *end,
const char **endPtr) {
2635 const char *next = start;
2640 if (! accountingDiffTolerated(parser, tok, start, next, __LINE__,
2642 accountingOnAbort(parser);
2673 parser->
m_processor = externalEntityInitProcessor3;
2674 return externalEntityInitProcessor3(parser, start, end, endPtr);
2678externalEntityInitProcessor3(
XML_Parser parser,
const char *start,
2679 const char *end,
const char **endPtr) {
2681 const char *next = start;
2693 result = processXmlDecl(parser, 1, start, next);
2719 parser->
m_processor = externalEntityContentProcessor;
2721 return externalEntityContentProcessor(parser, start, end, endPtr);
2725externalEntityContentProcessor(
XML_Parser parser,
const char *start,
2726 const char *end,
const char **endPtr) {
2728 = doContent(parser, 1, parser->
m_encoding, start, end, endPtr,
2732 if (! storeRawNames(parser))
2740 const char *s,
const char *end,
const char **nextPtr,
2745 const char **eventPP;
2746 const char **eventEndPP;
2757 const char *next = s;
2760 const char *accountAfter
2762 ? (haveMore ? s : end)
2764 if (! accountingDiffTolerated(parser, tok, s, accountAfter, __LINE__,
2766 accountingOnAbort(parser);
2782 reportDefault(parser, enc, s, end);
2786 if (startTagLevel == 0)
2797 if (startTagLevel > 0) {
2829 accountingDiffTolerated(parser, tok, (
char *)&ch,
2830 ((
char *)&ch) +
sizeof(
XML_Char), __LINE__,
2836 reportDefault(parser, enc, s, next);
2854 }
else if (! entity) {
2858 reportDefault(parser, enc, s, next);
2872 reportDefault(parser, enc, s, next);
2875 result = processInternalEntity(parser, entity,
XML_FALSE);
2881 context = getContext(parser);
2891 reportDefault(parser, enc, s, next);
2933 if ((fromPtr >= rawNameEnd)
2945 toPtr = (
XML_Char *)temp + convLen;
2950 *toPtr =
XML_T(
'\0');
2959 reportDefault(parser, enc, s, next);
2976 result = storeAtts(parser, enc, s, &name, &bindings,
2979 freeBindings(parser, bindings);
2990 *eventPP = *eventEndPP;
2995 reportDefault(parser, enc, s, next);
2997 freeBindings(parser, bindings);
3004 return epilogProcessor(parser, next, end, nextPtr);
3012 const char *rawName;
3020 || memcmp(
tag->
rawName, rawName, len) != 0) {
3030 if (parser->
m_ns && localPart) {
3038 *uri++ = *localPart++;
3049 reportDefault(parser, enc, s, next);
3065 return epilogProcessor(parser, next, end, nextPtr);
3078 reportDefault(parser, enc, s, next);
3087 reportDefault(parser, enc, s, next);
3111 reportDefault(parser, enc, s, next);
3113 = doCdataSection(parser, enc, &next, end, nextPtr, haveMore, account);
3138 reportDefault(parser, enc, s, end);
3142 if (startTagLevel == 0) {
3154 if (charDataHandler) {
3172 reportDefault(parser, enc, s, next);
3175 if (! reportProcessingInstruction(parser, enc, s, next))
3179 if (! reportComment(parser, enc, s, next))
3191 reportDefault(parser, enc, s, next);
3195 *eventPP = s = next;
3260 if (! elementType) {
3268 if (parser->
m_ns && ! setElementTypePrefix(parser, elementType))
3277 if (n >
INT_MAX - nDefaultAtts) {
3285 XML_AttrInfo *temp2;
3300#if UINT_MAX >= SIZE_MAX
3319# if UINT_MAX >= SIZE_MAX
3320 if ((
unsigned)parser->
m_attsSize > (
size_t)(-1) /
sizeof(XML_AttrInfo)) {
3326 temp2 = (XML_AttrInfo *)
REALLOC(parser, (
void *)parser->m_attInfo,
3328 if (temp2 == NULL) {
3332 parser->m_attInfo = temp2;
3334 if (n > oldAttsSize)
3339 for (i = 0; i <
n; i++) {
3342 XML_AttrInfo *currAttInfo = &parser->m_attInfo[i];
3346 = getAttributeId(parser, enc, currAtt->
name,
3351 currAttInfo->nameStart
3353 currAttInfo->nameEnd
3364 if ((attId->
name)[-1]) {
3369 (attId->
name)[-1] = 1;
3370 appAtts[attIndex++] = attId->
name;
3378 for (j = 0; j < nDefaultAtts; j++) {
3387 result = storeAttributeValue(
3396 appAtts[attIndex] = poolStoreString(&parser->
m_tempPool, enc,
3399 if (appAtts[attIndex] == 0)
3408 appAtts[attIndex], bindingsPtr);
3416 (attId->
name)[-1] = 2;
3425 for (i = 0; i < attIndex; i += 2)
3426 if (appAtts[i] == elementType->
idAtt->
name) {
3434 for (i = 0; i < nDefaultAtts; i++) {
3440 da->
value, bindingsPtr);
3446 appAtts[attIndex++] = da->
id->
name;
3447 appAtts[attIndex++] = da->
value;
3451 appAtts[attIndex++] = da->
id->
name;
3452 appAtts[attIndex++] = da->
value;
3456 appAtts[attIndex] = 0;
3473 if ((nPrefixes << 1)
3495#if UINT_MAX >= SIZE_MAX
3496 if (nsAttsSize > (
size_t)(-1) /
sizeof(
NS_ATT)) {
3504 nsAttsSize *
sizeof(
NS_ATT));
3516 for (j = nsAttsSize; j != 0;)
3522 for (; i < attIndex; i += 2) {
3527 unsigned long uriHash;
3531 copy_salt_to_sipkey(parser, &sip_key);
3532 sip24_init(&sip_state, &sip_key);
3536 if (!
id || ! id->
prefix) {
3557 for (j = 0; j < b->
uriLen; j++) {
3568 sip24_update(&sip_state, s, keylen(s) *
sizeof(
XML_Char));
3575 uriHash = (
unsigned long)sip24_final(&sip_state);
3580 unsigned char step = 0;
3581 unsigned long mask = nsAttsSize - 1;
3589 for (; *s1 == *s2 && *s1 != 0; s1++, s2++)
3596 j < step ? (j += nsAttsSize - step) : (j -= step);
3619 if (! --nPrefixes) {
3628 for (; i < attIndex; i += 2)
3629 ((
XML_Char *)(appAtts[i]))[-1] = 0;
3637 if (elementType->
prefix) {
3641 localPart = tagNamePtr->
str;
3646 localPart = tagNamePtr->
str;
3658 for (i = 0; localPart[i++];)
3679#if UINT_MAX >= SIZE_MAX
3698 memcpy(uri, localPart, i *
sizeof(
XML_Char));
3710is_rfc3986_uri_char(
XML_Char candidate) {
3714 switch (candidate) {
3827 static const XML_Char xmlNamespace[]
3836 static const int xmlLen = (int)
sizeof(xmlNamespace) /
sizeof(
XML_Char) - 1;
3838 static const XML_Char xmlnsNamespace[]
3844 static const int xmlnsLen
3845 = (int)
sizeof(xmlnsNamespace) /
sizeof(
XML_Char) - 1;
3870 for (len = 0; uri[len]; len++) {
3871 if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len]))
3874 if (! mustBeXML && isXMLNS
3875 && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
3897 && ! is_rfc3986_uri_char(uri[len])) {
3901 isXML = isXML && len == xmlLen;
3902 isXMLNS = isXMLNS && len == xmlnsLen;
3904 if (mustBeXML != isXML)
3925#if UINT_MAX >= SIZE_MAX
3952#if UINT_MAX >= SIZE_MAX
3991cdataSectionProcessor(
XML_Parser parser,
const char *start,
const char *end,
3992 const char **endPtr) {
3994 parser, parser->
m_encoding, &start, end, endPtr,
4000 parser->
m_processor = externalEntityContentProcessor;
4001 return externalEntityContentProcessor(parser, start, end, endPtr);
4004 return contentProcessor(parser, start, end, endPtr);
4015 const char *end,
const char **nextPtr,
XML_Bool haveMore,
4017 const char *s = *startPtr;
4018 const char **eventPP;
4019 const char **eventEndPP;
4032 const char *next = s;
4035 if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) {
4036 accountingOnAbort(parser);
4054 reportDefault(parser, enc, s, next);
4066 reportDefault(parser, enc, s, next);
4070 if (charDataHandler) {
4088 reportDefault(parser, enc, s, next);
4119 *eventPP = s = next;
4138ignoreSectionProcessor(
XML_Parser parser,
const char *start,
const char *end,
4139 const char **endPtr) {
4141 = doIgnoreSection(parser, parser->
m_encoding, &start, end, endPtr,
4147 return prologProcessor(parser, start, end, endPtr);
4157 const char *end,
const char **nextPtr,
XML_Bool haveMore) {
4158 const char *next = *startPtr;
4160 const char *s = *startPtr;
4161 const char **eventPP;
4162 const char **eventEndPP;
4185 tok = XmlIgnoreSectionTok(enc, s, end, &next);
4187 if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
4189 accountingOnAbort(parser);
4195 case XML_TOK_IGNORE_SECT:
4197 reportDefault(parser, enc, s, next);
4241 char encodingBuf[128];
4248 if (i ==
sizeof(encodingBuf) - 1
4250 encodingBuf[0] =
'\0';
4255 encodingBuf[i] =
'\0';
4268processXmlDecl(
XML_Parser parser,
int isGeneralTextEntity,
const char *s,
4270 const char *encodingName = NULL;
4271 const XML_Char *storedEncName = NULL;
4272 const ENCODING *newEncoding = NULL;
4273 const char *version = NULL;
4274 const char *versionend = NULL;
4275 const XML_Char *storedversion = NULL;
4276 int standalone = -1;
4281 accountingOnAbort(parser);
4288 &version, &versionend, &encodingName, &newEncoding, &standalone)) {
4289 if (isGeneralTextEntity)
4294 if (! isGeneralTextEntity && standalone == 1) {
4303 if (encodingName != NULL) {
4304 storedEncName = poolStoreString(
4307 if (! storedEncName)
4315 if (! storedversion)
4321 reportDefault(parser, parser->
m_encoding, s, next);
4336 }
else if (encodingName) {
4338 if (! storedEncName) {
4339 storedEncName = poolStoreString(
4342 if (! storedEncName)
4345 result = handleUnknownEncoding(parser, storedEncName);
4353 if (storedEncName || storedversion)
4364 for (i = 0; i < 256; i++)
4366 info.convert = NULL;
4368 info.release = NULL;
4370 encodingName, &info)) {
4375 info.release(info.
data);
4382 parser->m_unknownEncodingRelease = info.release;
4387 if (info.release != NULL)
4388 info.release(info.
data);
4394prologInitProcessor(
XML_Parser parser,
const char *s,
const char *end,
4395 const char **nextPtr) {
4396 enum XML_Error result = initializeEncoding(parser);
4400 return prologProcessor(parser, s, end, nextPtr);
4406externalParEntInitProcessor(
XML_Parser parser,
const char *s,
const char *end,
4407 const char **nextPtr) {
4408 enum XML_Error result = initializeEncoding(parser);
4418 return entityValueInitProcessor(parser, s, end, nextPtr);
4421 return externalParEntProcessor(parser, s, end, nextPtr);
4426entityValueInitProcessor(
XML_Parser parser,
const char *s,
const char *end,
4427 const char **nextPtr) {
4429 const char *start = s;
4430 const char *next = start;
4457 return storeEntityValue(parser, parser->
m_encoding, s, end,
4461 result = processXmlDecl(parser, 0, start, next);
4474 return entityValueProcessor(parser, next, end, nextPtr);
4486 if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
4488 accountingOnAbort(parser);
4510externalParEntProcessor(
XML_Parser parser,
const char *s,
const char *end,
4511 const char **nextPtr) {
4512 const char *next = s;
4539 if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
4541 accountingOnAbort(parser);
4550 return doProlog(parser, parser->
m_encoding, s, end, tok, next, nextPtr,
4556entityValueProcessor(
XML_Parser parser,
const char *s,
const char *end,
4557 const char **nextPtr) {
4558 const char *start = s;
4559 const char *next = s;
4594prologProcessor(
XML_Parser parser,
const char *s,
const char *end,
4595 const char **nextPtr) {
4596 const char *next = s;
4598 return doProlog(parser, parser->
m_encoding, s, end, tok, next, nextPtr,
4605 int tok,
const char *next,
const char **nextPtr,
XML_Bool haveMore,
4615 static const XML_Char atypeIDREFS[]
4617 static const XML_Char atypeENTITY[]
4619 static const XML_Char atypeENTITIES[]
4622 static const XML_Char atypeNMTOKEN[]
4624 static const XML_Char atypeNMTOKENS[]
4627 static const XML_Char notationPrefix[]
4640 const char **eventPP;
4641 const char **eventEndPP;
4705 case XML_ROLE_TEXT_DECL:
4708 if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) {
4709 accountingOnAbort(parser);
4716 enum XML_Error result = processXmlDecl(parser, 0, s, next);
4725 = poolStoreString(&parser->
m_tempPool, enc, s, next);
4745 case XML_ROLE_TEXT_DECL: {
4746 enum XML_Error result = processXmlDecl(parser, 1, s, next);
4766 pubId = poolStoreString(&parser->
m_tempPool, enc,
4771 normalizePublicId(pubId);
4775 goto alreadyChecked;
4788 normalizePublicId(tem);
4799 if (allowClosingDoctype !=
XML_TRUE) {
4822 externalSubsetName,
sizeof(
ENTITY));
4869 externalSubsetName,
sizeof(
ENTITY));
4893 return contentProcessor(parser, s, end, nextPtr);
4898 goto checkAttListDeclHandler;
4906 goto checkAttListDeclHandler;
4910 goto checkAttListDeclHandler;
4914 goto checkAttListDeclHandler;
4917 goto checkAttListDeclHandler;
4920 goto checkAttListDeclHandler;
4923 goto checkAttListDeclHandler;
4926 goto checkAttListDeclHandler;
4929 goto checkAttListDeclHandler;
4932 checkAttListDeclHandler:
4948 if (! poolAppend(&parser->
m_tempPool, enc, s, next))
4987 enum XML_Error result = storeAttributeValue(
4996 if (! defineAttribute(
5114 = poolStoreString(&dtd->
pool, enc, s, next);
5206 = poolStoreString(&parser->
m_tempPool, enc, s, next);
5217 ->m_declNotationName) {
5223 normalizePublicId(tem);
5266 case XML_ROLE_IGNORE_SECT: {
5269 reportDefault(parser, enc, s, next);
5271 result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore);
5285 if (parser->
m_groupSize > (
unsigned int)(-1) / 2u) {
5289 char *
const new_connector = (
char *)
REALLOC(
5291 if (new_connector == NULL) {
5303#if UINT_MAX >= SIZE_MAX
5304 if (parser->
m_groupSize > (
size_t)(-1) /
sizeof(
int)) {
5309 int *
const new_scaff_index = (
int *)
REALLOC(
5311 if (new_scaff_index == NULL)
5326 int myindex = nextScaffoldPart(parser);
5360 case XML_ROLE_INNER_PARAM_ENTITY_REF:
5405 }
else if (! entity) {
5421 result = processInternalEntity(parser, entity, betweenDecl);
5430 entityTrackingOnOpen(parser, entity, __LINE__);
5434 entityTrackingOnClose(parser, entity, __LINE__);
5438 entityTrackingOnClose(parser, entity, __LINE__);
5479 content->
name = NULL;
5504 goto elementContent;
5507 goto elementContent;
5510 goto elementContent;
5520 int myindex = nextScaffoldPart(parser);
5525 el = getElementType(parser, enc, s, nxt);
5531 for (;
name[nameLen++];)
5563 if (! handleDefault) {
5579 if (! reportProcessingInstruction(parser, enc, s, next))
5584 if (! reportComment(parser, enc, s, next))
5618 reportDefault(parser, enc, s, next);
5635epilogProcessor(
XML_Parser parser,
const char *s,
const char *end,
5636 const char **nextPtr) {
5640 const char *next = NULL;
5643 if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
5645 accountingOnAbort(parser);
5654 reportDefault(parser, parser->
m_encoding, s, next);
5665 reportDefault(parser, parser->
m_encoding, s, next);
5668 if (! reportProcessingInstruction(parser, parser->
m_encoding, s, next))
5672 if (! reportComment(parser, parser->
m_encoding, s, next))
5707 const char *textStart, *textEnd;
5723 entityTrackingOnOpen(parser, entity, __LINE__);
5728 openEntity->
entity = entity;
5733 textStart = (
const char *)entity->
textPtr;
5753 entity->
processed = (int)(next - textStart);
5757 entityTrackingOnClose(parser, entity, __LINE__);
5770internalEntityProcessor(
XML_Parser parser,
const char *s,
const char *end,
5771 const char **nextPtr) {
5773 const char *textStart, *textEnd;
5780 entity = openEntity->
entity;
5801 else if (textEnd != next
5807 entityTrackingOnClose(parser, entity, __LINE__);
5821 return doProlog(parser, parser->
m_encoding, s, end, tok, next, nextPtr,
5834 if (! storeRawNames(parser))
5842errorProcessor(
XML_Parser parser,
const char *s,
const char *end,
5843 const char **nextPtr) {
5852 const char *ptr,
const char *end,
STRING_POOL *pool,
5855 = appendAttributeValue(parser, enc, isCdata, ptr, end, pool, account);
5867 const char *ptr,
const char *end,
STRING_POOL *pool,
5879 if (! accountingDiffTolerated(parser, tok, ptr, next, __LINE__, account)) {
5880 accountingOnAbort(parser);
5904 if (! isCdata && n == 0x20
5917 for (i = 0; i <
n; i++) {
5923 if (! poolAppend(pool, enc, ptr, next))
5939 char checkEntityDecl;
5947 accountingDiffTolerated(parser, tok, (
char *)&ch,
5948 ((
char *)&ch) +
sizeof(
XML_Char), __LINE__,
5965 if (pool == &dtd->
pool)
5974 if (checkEntityDecl) {
5979 }
else if (! entity) {
6029 entityTrackingOnOpen(parser, entity, __LINE__);
6032 isCdata, (
const char *)entity->
textPtr,
6033 (
const char *)textEnd, pool,
6036 entityTrackingOnClose(parser, entity, __LINE__);
6067 const char *entityTextPtr,
const char *entityTextEnd,
6082 if (! poolGrow(pool))
6092 if (! accountingDiffTolerated(parser, tok, entityTextPtr, next, __LINE__,
6094 accountingOnAbort(parser);
6096 goto endEntityValue;
6111 goto endEntityValue;
6123 goto endEntityValue;
6129 goto endEntityValue;
6135 entityTrackingOnOpen(parser, entity, __LINE__);
6139 entityTrackingOnClose(parser, entity, __LINE__);
6142 goto endEntityValue;
6144 entityTrackingOnClose(parser, entity, __LINE__);
6152 entityTrackingOnOpen(parser, entity, __LINE__);
6153 result = storeEntityValue(
6157 entityTrackingOnClose(parser, entity, __LINE__);
6160 goto endEntityValue;
6169 goto endEntityValue;
6172 goto endEntityValue;
6175 if (! poolAppend(pool, enc, entityTextPtr, next)) {
6177 goto endEntityValue;
6184 if (pool->
end == pool->
ptr && ! poolGrow(pool)) {
6186 goto endEntityValue;
6188 *(pool->
ptr)++ = 0xA;
6198 goto endEntityValue;
6210 for (i = 0; i <
n; i++) {
6211 if (pool->
end == pool->
ptr && ! poolGrow(pool)) {
6213 goto endEntityValue;
6215 *(pool->
ptr)++ = buf[i];
6222 goto endEntityValue;
6227 goto endEntityValue;
6239 goto endEntityValue;
6242 entityTextPtr = next;
6255 if (*s ==
XML_T(
'\0'))
6274 const char *start,
const char *end) {
6280 reportDefault(parser, enc, start, end);
6285 target = poolStoreString(&parser->
m_tempPool, enc, start, tem);
6293 normalizeLines(data);
6305 reportDefault(parser, enc, start, end);
6308 data = poolStoreString(&parser->
m_tempPool, enc,
6313 normalizeLines(data);
6324 const char **eventPP;
6325 const char **eventEndPP;
6369 if (value || isId) {
6377 type->
idAtt = attId;
6402#if UINT_MAX >= SIZE_MAX
6430 for (name = elementType->
name; *name; name++) {
6434 for (s = elementType->
name; s != name; s++) {
6463 name = poolStoreString(&dtd->
pool, enc, start, end);
6472 if (id->
name != name)
6482 if (name[5] ==
XML_T(
'\0'))
6490 for (i = 0;
name[i]; i++) {
6494 for (j = 0; j < i; j++) {
6516#define CONTEXT_SEP XML_T(ASCII_FF)
6532 for (i = 0; i < len; i++) {
6560 hashTableIterInit(&iter, &(dtd->
prefixes));
6587 for (i = 0; i < len; i++)
6603 for (s = e->
name; *s; s++)
6619 while (*context !=
XML_T(
'\0')) {
6628 if (*s !=
XML_T(
'\0'))
6662 if (*context !=
XML_T(
'\0'))
6675normalizePublicId(
XML_Char *publicId) {
6678 for (s = publicId; *s; s++) {
6683 if (p != publicId && p[-1] != 0x20)
6690 if (p != publicId && p[-1] == 0x20)
6697 DTD *p = ms->malloc_fcn(
sizeof(
DTD));
6700 poolInit(&(p->
pool), ms);
6746 poolClear(&(p->
pool));
6786 poolDestroy(&(p->
pool));
6805 hashTableIterInit(&iter, &(oldDtd->
prefixes));
6808 const PREFIX *oldP = (
PREFIX *)hashTableIterNext(&iter);
6814 if (! lookup(oldParser, &(newDtd->
prefixes), name,
sizeof(
PREFIX)))
6928 const XML_Char *cachedOldBase = NULL;
6929 const XML_Char *cachedNewBase = NULL;
6931 hashTableIterInit(&iter, oldTable);
6936 const ENTITY *oldE = (
ENTITY *)hashTableIterNext(&iter);
6939 name = poolCopyString(newPool, oldE->
name);
6942 newE = (
ENTITY *)lookup(oldParser, newTable, name,
sizeof(
ENTITY));
6951 if (oldE->
base == cachedOldBase)
6952 newE->
base = cachedNewBase;
6954 cachedOldBase = oldE->
base;
6955 tem = poolCopyString(newPool, cachedOldBase);
6958 cachedNewBase = newE->
base = tem;
6962 tem = poolCopyString(newPool, oldE->
publicId);
6991 for (; *s1 == *s2; s1++, s2++)
7000 for (; *s; s++, len++)
7008 key->
k[1] = get_hash_secret_salt(parser);
7016 copy_salt_to_sipkey(parser, &key);
7017 sip24_init(&state, &key);
7018 sip24_update(&state, s, keylen(s) *
sizeof(
XML_Char));
7019 return (
unsigned long)sip24_final(&state);
7025 if (table->
size == 0) {
7038 memset(table->
v, 0, tsize);
7039 i = hash(parser, name) & ((
unsigned long)table->
size - 1);
7041 unsigned long h = hash(parser, name);
7042 unsigned long mask = (
unsigned long)table->
size - 1;
7043 unsigned char step = 0;
7045 while (table->
v[i]) {
7046 if (keyeq(name, table->
v[i]->
name))
7050 i < step ? (i += table->
size - step) : (i -= step);
7056 if (table->
used >> (table->
power - 1)) {
7057 unsigned char newPower = table->
power + 1;
7060 if (newPower >=
sizeof(
unsigned long) * 8 ) {
7064 size_t newSize = (size_t)1 << newPower;
7065 unsigned long newMask = (
unsigned long)newSize - 1;
7068 if (newSize > (
size_t)(-1) /
sizeof(
NAMED *)) {
7072 size_t tsize = newSize *
sizeof(
NAMED *);
7076 memset(newV, 0, tsize);
7077 for (i = 0; i < table->
size; i++)
7079 unsigned long newHash = hash(parser, table->
v[i]->
name);
7080 size_t j = newHash & newMask;
7084 step =
PROBE_STEP(newHash, newMask, newPower);
7085 j < step ? (j += newSize - step) : (j -= step);
7087 newV[j] = table->
v[i];
7091 table->
power = newPower;
7092 table->
size = newSize;
7095 while (table->
v[i]) {
7098 i < step ? (i += newSize - step) : (i -= step);
7105 memset(table->
v[i], 0, createSize);
7114 for (i = 0; i < table->
size; i++) {
7124 for (i = 0; i < table->
size; i++)
7141 iter->
end = iter->
p ? iter->
p + table->
size : NULL;
7146 while (iter->
p != iter->
end) {
7147 NAMED *tem = *(iter->
p)++;
7202 if (! pool->
ptr && ! poolGrow(pool))
7210 if (! poolGrow(pool))
7229 if (! pool->
ptr && ! poolGrow(pool)) {
7243 for (;
n > 0; --
n, s++) {
7265 if (! poolAppend(pool, enc, ptr, end))
7267 if (pool->
ptr == pool->
end && ! poolGrow(pool))
7274poolBytesToAllocateFor(
int blockSize) {
7282 const size_t stretch =
sizeof(
XML_Char);
7287 if (blockSize > (
int)(
INT_MAX / stretch))
7291 const int stretchedBlockSize = blockSize * (int)stretch;
7292 const int bytesToAllocate
7293 = (int)(offsetof(
BLOCK, s) + (
unsigned)stretchedBlockSize);
7294 if (bytesToAllocate < 0)
7297 return (
size_t)bytesToAllocate;
7304 if (pool->
start == 0) {
7328 int blockSize = (int)((
unsigned)(pool->
end - pool->
start) * 2U);
7329 size_t bytesToAllocate;
7333 const ptrdiff_t offsetInsideBlock = pool->
ptr - pool->
start;
7335 if (blockSize < 0) {
7345 bytesToAllocate = poolBytesToAllocateFor(blockSize);
7346 if (bytesToAllocate == 0)
7350 (
unsigned)bytesToAllocate);
7355 pool->
ptr = pool->
blocks->
s + offsetInsideBlock;
7357 pool->
end = pool->
start + blockSize;
7360 int blockSize = (int)(pool->
end - pool->
start);
7361 size_t bytesToAllocate;
7363 if (blockSize < 0) {
7380 if ((
int)((
unsigned)blockSize * 2U) < 0) {
7386 bytesToAllocate = poolBytesToAllocateFor(blockSize);
7387 if (bytesToAllocate == 0)
7393 tem->
size = blockSize;
7400 pool->
end = tem->
s + blockSize;
7429#if UINT_MAX >= SIZE_MAX
7480#if UINT_MAX >= SIZE_MAX
7555 (jobDest++)->numchildren = 0;
7557 for (; dest < destLimit; dest++) {
7559 const int src_node = (int)dest->numchildren;
7574 dest->numchildren = 0;
7575 dest->children = NULL;
7581 dest->children = jobDest;
7586 (jobDest++)->numchildren = (
unsigned int)cn;
7606 if (ret->
name != name)
7610 if (! setElementTypePrefix(parser, ret))
7618 size_t charsRequired = 0;
7622 while (s[charsRequired] != 0) {
7633 memcpy(result, s, charsRequired *
sizeof(
XML_Char));
7640accountingGetCurrentAmplification(
XML_Parser rootParser) {
7644 const float amplificationFactor
7650 return amplificationFactor;
7654accountingReportStats(
XML_Parser originParser,
const char *epilog) {
7655 const XML_Parser rootParser = getRootParserOf(originParser, NULL);
7662 const float amplificationFactor
7663 = accountingGetCurrentAmplification(rootParser);
7666 "10")
", indirect " EXPAT_FMT_ULL(
"10")
", amplification %8.2f%s",
7667 (
void *)rootParser, rootParser->m_accounting.countBytesDirect,
7668 rootParser->m_accounting.countBytesIndirect,
7669 (
double)amplificationFactor, epilog);
7674 accountingReportStats(originParser,
" ABORTING\n");
7679 unsigned int levelsAwayFromRootParser,
const char *before,
7680 const char *after, ptrdiff_t bytesMore,
int source_line,
7685 " (+" EXPAT_FMT_PTRDIFF_T(
"6")
" bytes %s|%d, xmlparse.c:%d) %*s\"",
7687 levelsAwayFromRootParser, source_line, 10,
"");
7689 const char ellipis[] =
"[..]";
7690 const size_t ellipsisLength =
sizeof(ellipis) - 1;
7691 const unsigned int contextLength = 10;
7694 const char *walker = before;
7697 <= (ptrdiff_t)(contextLength + ellipsisLength + contextLength)) {
7698 for (; walker < after; walker++) {
7702 for (; walker < before + contextLength; walker++) {
7705 fprintf(stderr, ellipis);
7706 walker = after - contextLength;
7707 for (; walker < after; walker++) {
7711 fprintf(stderr,
"\"\n");
7715accountingDiffTolerated(
XML_Parser originParser,
int tok,
const char *before,
7716 const char *after,
int source_line,
7732 unsigned int levelsAwayFromRootParser;
7734 = getRootParserOf(originParser, &levelsAwayFromRootParser);
7739 const ptrdiff_t bytesMore = after - before;
7748 *additionTarget += bytesMore;
7753 const float amplificationFactor
7754 = accountingGetCurrentAmplification(rootParser);
7757 || (amplificationFactor
7761 accountingReportStats(rootParser,
"");
7762 accountingReportDiff(rootParser, levelsAwayFromRootParser, before, after,
7763 bytesMore, source_line, account);
7785 const char *action,
int sourceLine) {
7790# if defined(XML_UNICODE)
7791 const char *
const entityName =
"[..]";
7793 const char *
const entityName = entity->
name;
7798 "expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n",
7799 (
void *)rootParser, rootParser->m_entity_stats.countEverOpened,
7800 rootParser->m_entity_stats.currentDepth,
7801 rootParser->m_entity_stats.maximumDepthSeen,
7802 (rootParser->m_entity_stats.currentDepth - 1) * 2,
"",
7808entityTrackingOnOpen(
XML_Parser originParser,
ENTITY *entity,
int sourceLine) {
7809 const XML_Parser rootParser = getRootParserOf(originParser, NULL);
7819 entityTrackingReportStats(rootParser, entity,
"OPEN ", sourceLine);
7823entityTrackingOnClose(
XML_Parser originParser,
ENTITY *entity,
int sourceLine) {
7824 const XML_Parser rootParser = getRootParserOf(originParser, NULL);
7827 entityTrackingReportStats(rootParser, entity,
"CLOSE", sourceLine);
7832getRootParserOf(
XML_Parser parser,
unsigned int *outLevelDiff) {
7834 unsigned int stepsTakenUpwards = 0;
7837 stepsTakenUpwards++;
7840 if (outLevelDiff != NULL) {
7841 *outLevelDiff = stepsTakenUpwards;
8371getDebugLevel(
const char *variableName,
unsigned long defaultDebugLevel) {
8372 const char *
const valueOrNull = getenv(variableName);
8373 if (valueOrNull == NULL) {
8374 return defaultDebugLevel;
8376 const char *
const value = valueOrNull;
8379 char *afterValue = (
char *)value;
8380 unsigned long debugLevel = strtoul(value, &afterValue, 10);
8381 if ((errno != 0) || (afterValue[0] !=
'\0')) {
8383 return defaultDebugLevel;
void(XMLCALL * XML_CommentHandler)(void *userData, const XML_Char *data)
void(XMLCALL * XML_EndElementHandler)(void *userData, const XML_Char *name)
void(XMLCALL * XML_EndNamespaceDeclHandler)(void *userData, const XML_Char *prefix)
void(XMLCALL * XML_SkippedEntityHandler)(void *userData, const XML_Char *entityName, int is_parameter_entity)
int(XMLCALL * XML_ExternalEntityRefHandler)(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId)
@ XML_FEATURE_SIZEOF_XML_LCHAR
@ XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT
@ XML_FEATURE_SIZEOF_XML_CHAR
@ XML_FEATURE_UNICODE_WCHAR_T
@ XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT
@ XML_FEATURE_CONTEXT_BYTES
void(XMLCALL * XML_EndCdataSectionHandler)(void *userData)
int(XMLCALL * XML_UnknownEncodingHandler)(void *encodingHandlerData, const XML_Char *name, XML_Encoding *info)
void(XMLCALL * XML_EndDoctypeDeclHandler)(void *userData)
#define XML_MAJOR_VERSION
void(XMLCALL * XML_StartElementHandler)(void *userData, const XML_Char *name, const XML_Char **atts)
void(XMLCALL * XML_ProcessingInstructionHandler)(void *userData, const XML_Char *target, const XML_Char *data)
#define XML_MINOR_VERSION
void(XMLCALL * XML_StartNamespaceDeclHandler)(void *userData, const XML_Char *prefix, const XML_Char *uri)
void(XMLCALL * XML_XmlDeclHandler)(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
void(XMLCALL * XML_StartCdataSectionHandler)(void *userData)
void(XMLCALL * XML_UnparsedEntityDeclHandler)(void *userData, const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName)
@ XML_ERROR_UNCLOSED_TOKEN
@ XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
@ XML_ERROR_NOT_STANDALONE
@ XML_ERROR_INCOMPLETE_PE
@ XML_ERROR_RECURSIVE_ENTITY_REF
@ XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
@ XML_ERROR_ENTITY_DECLARED_IN_PE
@ XML_ERROR_DUPLICATE_ATTRIBUTE
@ XML_ERROR_EXTERNAL_ENTITY_HANDLING
@ XML_ERROR_INCORRECT_ENCODING
@ XML_ERROR_MISPLACED_XML_PI
@ XML_ERROR_AMPLIFICATION_LIMIT_BREACH
@ XML_ERROR_PARAM_ENTITY_REF
@ XML_ERROR_FEATURE_REQUIRES_XML_DTD
@ XML_ERROR_RESERVED_PREFIX_XML
@ XML_ERROR_UNEXPECTED_STATE
@ XML_ERROR_JUNK_AFTER_DOC_ELEMENT
@ XML_ERROR_NOT_SUSPENDED
@ XML_ERROR_UNCLOSED_CDATA_SECTION
@ XML_ERROR_RESERVED_NAMESPACE_URI
@ XML_ERROR_UNDEFINED_ENTITY
@ XML_ERROR_UNBOUND_PREFIX
@ XML_ERROR_UNDECLARING_PREFIX
@ XML_ERROR_INVALID_TOKEN
@ XML_ERROR_BINARY_ENTITY_REF
@ XML_ERROR_UNKNOWN_ENCODING
@ XML_ERROR_INVALID_ARGUMENT
@ XML_ERROR_RESERVED_PREFIX_XMLNS
#define XML_STATUS_SUSPENDED
struct XML_cp XML_Content
@ XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
@ XML_PARAM_ENTITY_PARSING_NEVER
void(XMLCALL * XML_AttlistDeclHandler)(void *userData, const XML_Char *elname, const XML_Char *attname, const XML_Char *att_type, const XML_Char *dflt, int isrequired)
int(XMLCALL * XML_NotStandaloneHandler)(void *userData)
#define XML_MICRO_VERSION
struct XML_ParserStruct * XML_Parser
void(XMLCALL * XML_StartDoctypeDeclHandler)(void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset)
void(XMLCALL * XML_CharacterDataHandler)(void *userData, const XML_Char *s, int len)
void(XMLCALL * XML_EntityDeclHandler)(void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName)
void(XMLCALL * XML_NotationDeclHandler)(void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId)
void(XMLCALL * XML_DefaultHandler)(void *userData, const XML_Char *s, int len)
void(XMLCALL * XML_ElementDeclHandler)(void *userData, const XML_Char *name, XML_Content *model)
#define XML_CONTEXT_BYTES
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT
#define EXPAT_FMT_ULL(midpart)
const char * name(G4int ptype)
enum XML_Content_Quant quant
enum XML_Content_Type type
unsigned contentStringLen
CONTENT_SCAFFOLD * scaffold
XML_Bool hasParamEntityRefs
HASH_TABLE generalEntities
STRING_POOL entityValuePool
DEFAULT_ATTRIBUTE * defaultAtts
const ATTRIBUTE_ID * idAtt
const XML_Char * publicId
const XML_Char * systemId
const XML_Char * notation
const XML_Memory_Handling_Suite * mem
const XML_Memory_Handling_Suite * mem
const XML_Char * localPart
void *(* realloc_fcn)(void *ptr, size_t size)
void *(* malloc_fcn)(size_t size)
void(* free_fcn)(void *ptr)
XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler
XML_XmlDeclHandler m_xmlDeclHandler
const ENCODING * m_encoding
XML_CommentHandler m_commentHandler
XML_Bool m_declAttributeIsCdata
XML_ExternalEntityRefHandler m_externalEntityRefHandler
XML_UnknownEncodingHandler m_unknownEncodingHandler
enum XML_Error m_errorCode
XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler
unsigned char m_nsAttsPower
XML_StartElementHandler m_startElementHandler
XML_Bool m_defaultExpandInternalEntities
const char * m_eventEndPtr
const XML_Char * m_doctypeName
void * m_unknownEncodingMem
XML_SkippedEntityHandler m_skippedEntityHandler
XML_EndElementHandler m_endElementHandler
XML_EntityDeclHandler m_entityDeclHandler
XML_Parser m_externalEntityRefHandlerArg
void(XMLCALL *m_unknownEncodingRelease)(void *)
const XML_Memory_Handling_Suite m_mem
XML_Bool m_declAttributeIsId
enum XML_ParamEntityParsing m_paramEntityParsing
void * m_unknownEncodingHandlerData
XML_AttlistDeclHandler m_attlistDeclHandler
const XML_Char * m_curBase
XML_Parser m_parentParser
void * m_unknownEncodingData
ELEMENT_TYPE * m_declElementType
ATTRIBUTE_ID * m_declAttributeId
const ENCODING * m_internalEncoding
unsigned long m_hash_secret_salt
XML_Index m_parseEndByteIndex
XML_EndCdataSectionHandler m_endCdataSectionHandler
const XML_Char * m_protocolEncodingName
const XML_Char * m_declAttributeType
const XML_Char * m_declNotationName
XML_NotationDeclHandler m_notationDeclHandler
ENTITY_STATS m_entity_stats
OPEN_INTERNAL_ENTITY * m_freeInternalEntities
OPEN_INTERNAL_ENTITY * m_openInternalEntities
XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler
BINDING * m_inheritedBindings
BINDING * m_freeBindingList
XML_ElementDeclHandler m_elementDeclHandler
XML_DefaultHandler m_defaultHandler
XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler
INIT_ENCODING m_initEncoding
XML_Char m_namespaceSeparator
const XML_Char * m_declNotationPublicId
XML_ParsingStatus m_parsingStatus
const XML_Char * m_doctypeSysid
const char * m_parseEndPtr
const char * m_positionPtr
XML_NotStandaloneHandler m_notStandaloneHandler
XML_ProcessingInstructionHandler m_processingInstructionHandler
XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler
XML_CharacterDataHandler m_characterDataHandler
PROLOG_STATE m_prologState
unsigned long m_nsAttsVersion
XML_StartCdataSectionHandler m_startCdataSectionHandler
const XML_Char * m_doctypePubid
enum XML_Content_Quant quant
enum XML_Content_Type type
XmlBigCount countBytesIndirect
XmlBigCount countBytesDirect
float maximumAmplificationFactor
unsigned long long activationThresholdBytes
struct binding * prevPrefixBinding
const struct attribute_id * attId
struct binding * nextTagBinding
unsigned int countEverOpened
unsigned int currentDepth
unsigned int maximumDepthSeen
struct open_internal_entity * next
const char * internalEventEndPtr
const char * internalEventPtr
XML_Parser XMLCALL XML_ParserCreate(const XML_Char *encodingName)
void *XMLCALL XML_MemRealloc(XML_Parser parser, void *ptr, size_t size)
void XMLCALL XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end)
void XMLCALL XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *data)
enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p)
const XML_Feature *XMLCALL XML_GetFeatureList(void)
void XMLCALL XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler)
void XMLCALL XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler)
void XMLCALL XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler)
#define PROBE_STEP(hash, mask, power)
int XMLCALL XML_GetSpecifiedAttributeCount(XML_Parser parser)
void XMLCALL XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl)
enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable)
#define INIT_SCAFFOLD_ELEMENTS
#define REALLOC(parser, p, s)
void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler)
void XMLCALL XML_FreeContentModel(XML_Parser parser, XML_Content *model)
const char *XMLCALL XML_GetInputContext(XML_Parser parser, int *offset, int *size)
XML_Parser XMLCALL XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep)
unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser)
#define INIT_DATA_BUF_SIZE
void XMLCALL XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl)
XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser)
void XMLCALL XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
XML_Expat_Version XMLCALL XML_ExpatVersionInfo(void)
XML_Parser XMLCALL XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName)
void *XMLCALL XML_MemMalloc(XML_Parser parser, size_t size)
#define INIT_ATTS_VERSION
XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser)
int XMLCALL XML_GetIdAttributeIndex(XML_Parser parser)
enum XML_Error XMLCALL XML_GetErrorCode(XML_Parser parser)
#define MUST_CONVERT(enc, s)
enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser)
const XML_LChar *XMLCALL XML_ErrorString(enum XML_Error code)
void XMLCALL XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)
void XMLCALL XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status)
enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
void *XMLCALL XML_GetBuffer(XML_Parser parser, int len)
void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end)
#define XmlGetInternalEncodingNS
#define MALLOC(parser, s)
void XMLCALL XML_DefaultCurrent(XML_Parser parser)
#define INIT_TAG_BUF_SIZE
void XMLCALL XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler)
struct entity_stats ENTITY_STATS
const XML_Char *XMLCALL XML_GetBase(XML_Parser parser)
void XMLCALL XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler)
void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end)
enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start, const char *end, const char **endPtr)
struct open_internal_entity OPEN_INTERNAL_ENTITY
unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser)
void XMLCALL XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end)
#define XmlGetInternalEncoding
void XMLCALL XML_MemFree(XML_Parser parser, void *ptr)
const XML_LChar *XMLCALL XML_ExpatVersion(void)
XML_Bool XMLCALL XML_ParserReset(XML_Parser parser, const XML_Char *encodingName)
unsigned long long XmlBigCount
XML_Bool XMLCALL XML_SetBillionLaughsAttackProtectionMaximumAmplification(XML_Parser parser, float maximumAmplificationFactor)
void XMLCALL XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start)
void XMLCALL XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler)
#define poolDiscard(pool)
int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt)
void XMLCALL XML_SetUserData(XML_Parser parser, void *p)
void XMLCALL XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start)
struct attribute_id ATTRIBUTE_ID
enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler)
#define EXPAT_SAFE_PTR_DIFF(p, q)
void XMLCALL XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end)
XML_Bool XMLCALL XML_SetBillionLaughsAttackProtectionActivationThreshold(XML_Parser parser, unsigned long long activationThresholdBytes)
#define poolAppendChar(pool, c)
void XMLCALL XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end)
void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler)
void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start)
void XMLCALL XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start)
#define poolLastChar(pool)
void XMLCALL XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler)
const char * unsignedCharToPrintable(unsigned char c)
int XMLCALL XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing peParsing)
struct accounting ACCOUNTING
enum XML_Status XMLCALL XML_ResumeParser(XML_Parser parser)
void XMLCALL XML_UseParserAsHandlerArg(XML_Parser parser)
enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
void XMLCALL XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler)
void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
int XMLCALL XML_GetCurrentByteCount(XML_Parser parser)
void XMLCALL XML_ParserFree(XML_Parser parser)
void XMLCALL XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler)
@ XML_ACCOUNT_ENTITY_EXPANSION
void XmlPrologStateInit(PROLOG_STATE *state)
void XmlPrologStateInitExternalEntity(PROLOG_STATE *state)
#define XmlTokenRole(state, tok, ptr, end, enc)
@ XML_ROLE_NOTATION_PUBLIC_ID
@ XML_ROLE_GROUP_CLOSE_REP
@ XML_ROLE_CONTENT_PCDATA
@ XML_ROLE_CONTENT_ELEMENT_REP
@ XML_ROLE_ENTITY_COMPLETE
@ XML_ROLE_DOCTYPE_INTERNAL_SUBSET
@ XML_ROLE_ATTRIBUTE_TYPE_ENTITY
@ XML_ROLE_NOTATION_NO_SYSTEM_ID
@ XML_ROLE_PARAM_ENTITY_REF
@ XML_ROLE_ATTRIBUTE_TYPE_ENTITIES
@ XML_ROLE_ENTITY_NOTATION_NAME
@ XML_ROLE_GROUP_SEQUENCE
@ XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS
@ XML_ROLE_ATTLIST_ELEMENT_NAME
@ XML_ROLE_GROUP_CLOSE_OPT
@ XML_ROLE_IMPLIED_ATTRIBUTE_VALUE
@ XML_ROLE_ATTRIBUTE_TYPE_CDATA
@ XML_ROLE_ATTRIBUTE_ENUM_VALUE
@ XML_ROLE_ENTITY_SYSTEM_ID
@ XML_ROLE_CONTENT_ELEMENT
@ XML_ROLE_ATTRIBUTE_NOTATION_VALUE
@ XML_ROLE_DOCTYPE_SYSTEM_ID
@ XML_ROLE_NOTATION_SYSTEM_ID
@ XML_ROLE_ATTRIBUTE_NAME
@ XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN
@ XML_ROLE_ATTRIBUTE_TYPE_ID
@ XML_ROLE_ENTITY_PUBLIC_ID
@ XML_ROLE_INSTANCE_START
@ XML_ROLE_CONTENT_ELEMENT_PLUS
@ XML_ROLE_GENERAL_ENTITY_NAME
@ XML_ROLE_PARAM_ENTITY_NAME
@ XML_ROLE_DEFAULT_ATTRIBUTE_VALUE
@ XML_ROLE_GROUP_CLOSE_PLUS
@ XML_ROLE_REQUIRED_ATTRIBUTE_VALUE
@ XML_ROLE_FIXED_ATTRIBUTE_VALUE
@ XML_ROLE_CONTENT_ELEMENT_OPT
@ XML_ROLE_ATTRIBUTE_TYPE_IDREFS
@ XML_ROLE_DOCTYPE_PUBLIC_ID
@ XML_ROLE_ATTRIBUTE_TYPE_IDREF
ENCODING * XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert, void *userData)
ENCODING * XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, void *userData)
int XmlSizeOfUnknownEncoding(void)
#define XmlGetAttributes(enc, ptr, attsMax, atts)
int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr)
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr)
#define XmlNameLength(enc, ptr)
#define XML_TOK_PARTIAL_CHAR
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name)
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr)
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS
#define XML_TOK_ENTITY_REF
#define XmlContentTok(enc, ptr, end, nextTokPtr)
#define XML_TOK_DATA_NEWLINE
#define XmlPrologTok(enc, ptr, end, nextTokPtr)
#define XmlIsPublicId(enc, ptr, end, badPtr)
#define XML_TOK_START_TAG_WITH_ATTS
int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr)
#define XML_TOK_CDATA_SECT_CLOSE
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name)
#define XML_TOK_DATA_CHARS
#define XML_TOK_PARAM_ENTITY_REF
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS
#define XML_TOK_TRAILING_RSQB
#define XmlCharRefNumber(enc, ptr)
#define XmlPredefinedEntityName(enc, ptr, end)
@ XML_CONVERT_INPUT_INCOMPLETE
#define XML_TOK_ATTRIBUTE_VALUE_S
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr)
#define XML_TOK_START_TAG_NO_ATTS
#define XmlSkipS(enc, ptr)
#define XML_TOK_TRAILING_CR
#define XML_TOK_CDATA_SECT_OPEN
#define XML_TOK_INSTANCE_START
#define XmlUpdatePosition(enc, ptr, end, pos)