1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

Issue #2889 - Part 5: Rewrite patches for Expat 2.7.3.

- Skipped the fix for BZ 569229 because I don't know where to apply that; the
  processInternalEntity method no longer exists. Hopefully the bug doesn't re-
  appear.
- Previous fixes for 3rd and 13th patches have been merged to their respective
  patches as well.
- 15th patch is now a fix for the 13th and 14th since somewhere between 2.6.4
  and 2.7.3 has made use of a debugging method we don't want to use as well as
  a new boolean method called parserBusy which got mistakenly excluded as an
  unused API while rewriting the 14th patch.
This commit is contained in:
Job Bautista
2026-01-11 21:26:25 +08:00
committed by roytam1
parent 8956c61187
commit a730f838c8
18 changed files with 338 additions and 464 deletions
+15 -22
View File
@@ -1,46 +1,39 @@
diff --git a/lib/expat_external.h b/lib/expat_external.h
--- a/lib/expat_external.h
+++ b/lib/expat_external.h
@@ -137,6 +137,9 @@ extern "C" {
@@ -138,6 +138,7 @@
# endif
# endif
#endif
+/* BEGIN MOZILLA CHANGE (typedef XML_Char to char16_t) */
+#if 0
+
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
# ifdef XML_UNICODE_WCHAR_T
+#ifndef MOZILLA_CLIENT /* typedef XML_Char to char16_t */
# ifdef XML_UNICODE /* Information is UTF-16 encoded. */
# ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
@@ -150,6 +153,9 @@ typedef char XML_Char;
@@ -150,6 +151,7 @@
typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
# endif /* XML_UNICODE */
+#endif /* MOZILLA_CLIENT */
+#endif
+/* END MOZILLA CHANGE */
+
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
# ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
typedef long long XML_Index;
typedef unsigned long long XML_Size;
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -194,6 +194,9 @@ typedef char ICHAR;
@@ -195,6 +195,7 @@
#endif
+/* BEGIN MOZILLA CHANGE (typedef XML_Char to char16_t) */
+#if 0
+
+#ifndef MOZILLA_CLIENT /* typedef XML_Char to char16_t */
#ifdef XML_UNICODE
# ifdef XML_UNICODE_WCHAR_T
@@ -211,6 +214,9 @@ typedef char ICHAR;
@@ -211,6 +212,7 @@
# define XML_L(x) x
#endif
+#endif /* MOZILLA_CLIENT */
+#endif
+/* END MOZILLA CHANGE */
+
/* Round up n to be a multiple of sz, where sz is a power of 2. */
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
+4 -5
View File
@@ -1,14 +1,13 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -269,7 +269,9 @@ typedef struct {
#define INIT_DATA_BUF_SIZE 1024
@@ -267,6 +267,9 @@
#define INIT_ATTS_SIZE 16
#define INIT_ATTS_VERSION 0xFFFFFFFF
-#define INIT_BLOCK_SIZE 1024
+/* BEGIN MOZILLA CHANGE (Avoid slop in poolGrow() allocations) */
#define INIT_BLOCK_SIZE 1024
+#ifdef MOZILLA_CLIENT /* Avoid slop in poolGrow() allocations */
+#define INIT_BLOCK_SIZE ((int)(1024 - (offsetof(BLOCK, s) / sizeof(XML_Char))))
+/* END MOZILLA CHANGE */
+#endif
#define INIT_BUFFER_SIZE 1024
#define EXPAND_SPARE 24
+14 -14
View File
@@ -1,47 +1,47 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -764,6 +764,9 @@ struct XML_ParserStruct {
ACCOUNTING m_accounting;
@@ -787,6 +787,9 @@
MALLOC_TRACKER m_alloc_tracker;
ENTITY_STATS m_entity_stats;
#endif
+/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
+#ifdef MOZILLA_CLIENT /* Report opening tag of mismatched closing tag */
+ const XML_Char* m_mismatch;
+/* END MOZILLA CHANGE */
+#endif
XML_Bool m_reenter;
};
#define MALLOC(parser, s) (parser->m_mem.malloc_fcn((s)))
@@ -1189,6 +1192,10 @@ parserCreate(const XML_Char *encodingNam
@@ -1535,6 +1538,10 @@
parser->m_internalEncoding = XmlGetInternalEncoding();
}
+/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
+#ifdef MOZILLA_CLIENT /* Report opening tag of mismatched closing tag */
+ parser->m_mismatch = NULL;
+/* END MOZILLA CHANGE */
+#endif
+
return parser;
}
@@ -2645,6 +2652,14 @@ XML_SetBillionLaughsAttackProtectionActi
@@ -3110,6 +3117,14 @@
}
#endif /* XML_GE == 1 */
+/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
+#ifdef MOZILLA_CLIENT /* Report opening tag of mismatched closing tag */
+const XML_Char * XMLCALL
+MOZ_XML_GetMismatchedTag(XML_Parser parser)
+{
+ return parser->m_mismatch;
+}
+/* END MOZILLA CHANGE */
+#endif
+
XML_Bool XMLCALL
XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled) {
if (parser != NULL && (enabled == XML_TRUE || enabled == XML_FALSE)) {
@@ -3117,6 +3132,33 @@ doContent(XML_Parser parser, int startTa
@@ -3590,6 +3605,33 @@
len = XmlNameLength(enc, rawName);
if (len != tag->rawNameLength
|| memcmp(tag->rawName, rawName, len) != 0) {
+/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
+#ifdef MOZILLA_CLIENT /* Report opening tag of mismatched closing tag */
+ /* This code is copied from the |if (parser->m_endElementHandler)|
+ block below
+ */
@@ -67,7 +67,7 @@ diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+ *uri = XML_T('\0');
+ }
+ parser->m_mismatch = tag->name.str;
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
*eventPP = rawName;
return XML_ERROR_TAG_MISMATCH;
}
+27 -23
View File
@@ -1,37 +1,41 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -796,6 +796,8 @@ static const XML_Char implicitContext[]
@@ -608,7 +608,9 @@
static XML_Char *copyString(const XML_Char *s, XML_Parser parser);
+#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
static unsigned long generate_hash_secret_salt(XML_Parser parser);
+#endif
static XML_Bool startParsing(XML_Parser parser);
static XML_Parser parserCreate(const XML_Char *encodingName,
@@ -1043,6 +1045,7 @@
ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e,
'\0'};
+/* BEGIN MOZILLA CHANGE (we already set a salt through XML_SetHashSalt) */
+#if 0
+#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
/* To avoid warnings about unused functions: */
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
@@ -957,9 +959,13 @@ ENTROPY_DEBUG(const char *label, unsigne
}
return entropy;
}
+#endif
+/* END MOZILLA CHANGE */
static unsigned long
generate_hash_secret_salt(XML_Parser parser) {
+/* BEGIN MOZILLA CHANGE (we already set a salt through XML_SetHashSalt) */
+#if 0
unsigned long entropy;
(void)parser;
@@ -999,6 +1005,10 @@ generate_hash_secret_salt(XML_Parser par
entropy * (unsigned long)2305843009213693951ULL);
@@ -1250,6 +1253,7 @@
}
#endif
+#else
+ abort();
+#endif
+/* END MOZILLA CHANGE */
}
+#endif /* MOZILLA_CLIENT */
static unsigned long
get_hash_secret_salt(XML_Parser parser) {
@@ -1326,9 +1330,11 @@
static XML_Bool /* only valid for root parser */
startParsing(XML_Parser parser) {
+#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
/* hash functions must be initialized before setContext() is called */
if (parser->m_hash_secret_salt == 0)
parser->m_hash_secret_salt = generate_hash_secret_salt(parser);
+#endif
if (parser->m_ns) {
/* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it
+3 -3
View File
@@ -1,14 +1,14 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -2328,6 +2328,10 @@ XML_ResumeParser(XML_Parser parser) {
@@ -2744,6 +2744,10 @@
XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,
parser->m_bufferPtr, &parser->m_position);
parser->m_positionPtr = parser->m_bufferPtr;
+/* BEGIN MOZILLA CHANGE (always set m_eventPtr/m_eventEndPtr) */
+#ifdef MOZILLA_CLIENT /* always set m_eventPtr/m_eventEndPtr */
+ parser->m_eventPtr = parser->m_bufferPtr;
+ parser->m_eventEndPtr = parser->m_bufferPtr;
+/* END MOZILLA CHANGE */
+#endif
return result;
}
+4 -6
View File
@@ -1,17 +1,15 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -2357,7 +2357,13 @@ XML_GetCurrentByteIndex(XML_Parser parse
@@ -2773,7 +2773,11 @@
if (parser->m_eventPtr)
return (XML_Index)(parser->m_parseEndByteIndex
- (parser->m_parseEndPtr - parser->m_eventPtr));
+/* BEGIN MOZILLA CHANGE (fix XML_GetCurrentByteIndex) */
+#if 0
return -1;
+#else
+#ifdef MOZILLA_CLIENT /* fix XML_GetCurrentByteIndex */
+ return parser->m_parseEndByteIndex;
+#else
return -1;
+#endif
+/* END MOZILLA CHANGE */
}
int XMLCALL
+16 -8
View File
@@ -1,17 +1,25 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -2680,6 +2680,13 @@ MOZ_XML_GetMismatchedTag(XML_Parser pars
@@ -3131,12 +3131,20 @@
}
/* END MOZILLA CHANGE */
#endif /* XML_GE == 1 */
+/* BEGIN MOZILLA CHANGE (Report whether the parser is currently expanding an entity) */
-#ifdef MOZILLA_CLIENT /* Report opening tag of mismatched closing tag */
+#ifdef MOZILLA_CLIENT
+/* Report opening tag of mismatched closing tag */
const XML_Char * XMLCALL
MOZ_XML_GetMismatchedTag(XML_Parser parser)
{
return parser->m_mismatch;
}
+
+/* Report whether the parser is currently expanding an entity */
+XML_Bool XMLCALL
+MOZ_XML_ProcessingEntityValue(XML_Parser parser) {
+MOZ_XML_ProcessingEntityValue(XML_Parser parser)
+{
+ return parser->m_openInternalEntities != NULL;
+}
+/* END MOZILLA CHANGE */
+
#endif
XML_Bool XMLCALL
XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled) {
if (parser != NULL && (enabled == XML_TRUE || enabled == XML_FALSE)) {
+36 -49
View File
@@ -1,86 +1,73 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -491,6 +491,13 @@ static enum XML_Error doProlog(XML_Parse
@@ -508,6 +508,14 @@
enum XML_Account account);
static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity,
XML_Bool betweenDecl);
+/* BEGIN MOZILLA CHANGE (Bug 1746996 - Ensure that storeRawNames is always called) */
static enum XML_Error processEntity(XML_Parser parser, ENTITY *entity,
XML_Bool betweenDecl, enum EntityType type);
+#ifdef MOZILLA_CLIENT
+/* Bug 1746996 - Ensure that storeRawNames is always called */
+static enum XML_Error doContentInternal(XML_Parser parser, int startTagLevel,
+ const ENCODING *enc, const char *start,
+ const char *end, const char **endPtr,
+ XML_Bool haveMore,
+ enum XML_Account account);
+/* END MOZILLA CHANGE */
+#endif
static enum XML_Error doContent(XML_Parser parser, int startTagLevel,
const ENCODING *enc, const char *start,
const char *end, const char **endPtr,
@@ -2756,10 +2763,14 @@ contentProcessor(XML_Parser parser, cons
enum XML_Error result = doContent(
parser, 0, parser->m_encoding, start, end, endPtr,
(XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_ACCOUNT_DIRECT);
+/* BEGIN MOZILLA CHANGE (Bug 1746996 - Ensure that storeRawNames is always called) */
+#if 0
@@ -3217,10 +3225,12 @@
parser, parser->m_parentParser ? 1 : 0, parser->m_encoding, start, end,
endPtr, (XML_Bool)! parser->m_parsingStatus.finalBuffer,
XML_ACCOUNT_DIRECT);
+#ifndef MOZILLA_CLIENT /* Bug 1746996 - Ensure that storeRawNames is always called */
if (result == XML_ERROR_NONE) {
if (! storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
}
+#endif
+/* END MOZILLA CHANGE */
return result;
}
@@ -2872,6 +2883,24 @@ externalEntityContentProcessor(XML_Parse
@@ -3338,17 +3348,41 @@
= doContent(parser, 1, parser->m_encoding, start, end, endPtr,
(XML_Bool)! parser->m_parsingStatus.finalBuffer,
XML_ACCOUNT_ENTITY_EXPANSION);
+/* BEGIN MOZILLA CHANGE (Bug 1746996 - Ensure that storeRawNames is always called) */
+#if 0
+#ifndef MOZILLA_CLIENT /* Bug 1746996 - Ensure that storeRawNames is always called */
if (result == XML_ERROR_NONE) {
if (! storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
}
+#endif
return result;
}
+#ifdef MOZILLA_CLIENT
+/* Bug 1746996 - Ensure that storeRawNames is always called */
static enum XML_Error
doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
const char *s, const char *end, const char **nextPtr,
XML_Bool haveMore, enum XML_Account account) {
+ enum XML_Error result = doContentInternal(parser, startTagLevel, enc, s, end,
+ nextPtr, haveMore, account);
+ if (result == XML_ERROR_NONE) {
+ if (! storeRawNames(parser))
+ return XML_ERROR_NO_MEMORY;
+ }
+#endif
+/* END MOZILLA CHANGE */
+ return result;
+}
+
+
+static enum XML_Error
+doContentInternal(XML_Parser parser, int startTagLevel, const ENCODING *enc,
+ const char *s, const char *end, const char **nextPtr,
+ XML_Bool haveMore, enum XML_Account account) {
+#else
+static enum XML_Error
+doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
+ const char *s, const char *end, const char **nextPtr,
+ XML_Bool haveMore, enum XML_Account account) {
+/* BEGIN MOZILLA CHANGE (Bug 1746996 - Ensure that storeRawNames is always called) */
+ enum XML_Error result = doContentInternal(parser, startTagLevel, enc, s, end,
+ nextPtr, haveMore, account);
if (result == XML_ERROR_NONE) {
if (! storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
@@ -2880,9 +2909,10 @@ externalEntityContentProcessor(XML_Parse
}
static enum XML_Error
-doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
- const char *s, const char *end, const char **nextPtr,
- XML_Bool haveMore, enum XML_Account account) {
+doContentInternal(XML_Parser parser, int startTagLevel, const ENCODING *enc,
+ const char *s, const char *end, const char **nextPtr,
+ XML_Bool haveMore, enum XML_Account account) {
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
/* save one level of indirection */
DTD *const dtd = parser->m_dtd;
@@ -6038,10 +6068,14 @@ internalEntityProcessor(XML_Parser parse
parser->m_encoding, s, end, nextPtr,
(XML_Bool)! parser->m_parsingStatus.finalBuffer,
XML_ACCOUNT_DIRECT);
+/* BEGIN MOZILLA CHANGE (Bug 1746996 - Ensure that storeRawNames is always called) */
+#if 0
if (result == XML_ERROR_NONE) {
if (! storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
}
+#endif
+/* END MOZILLA CHANGE */
return result;
}
}
@@ -1,33 +1,31 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -3028,9 +3028,15 @@ doContentInternal(XML_Parser parser, int
@@ -3498,9 +3498,14 @@
} else if (! entity) {
if (parser->m_skippedEntityHandler)
parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
+/* BEGIN MOZILLA CHANGE (Bug 35984 - Undeclared entities are ignored when external DTD not found) */
+#if 0
+#ifdef MOZILLA_CLIENT
+/* Bug 35984 - Undeclared entities are ignored when external DTD not found */
+ return XML_ERROR_UNDEFINED_ENTITY;
+#else
else if (parser->m_defaultHandler)
reportDefault(parser, enc, s, next);
break;
+#else
+ return XML_ERROR_UNDEFINED_ENTITY;
+#endif
+/* END MOZILLA CHANGE */
}
if (entity->open)
return XML_ERROR_RECURSIVE_ENTITY_REF;
@@ -6229,7 +6235,13 @@ appendAttributeValue(XML_Parser parser,
@@ -6796,7 +6801,12 @@
if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
reportDefault(parser, enc, ptr, next);
*/
+/* BEGIN MOZILLA CHANGE (Bug 35984 - Undeclared entities are ignored when external DTD not found) */
+#if 0
break;
+#else
+#ifdef MOZILLA_CLIENT
+/* Bug 35984 - Undeclared entities are ignored when external DTD not found */
+ return XML_ERROR_UNDEFINED_ENTITY;
+#else
break;
+#endif
+/* END MOZILLA CHANGE */
}
if (entity->open) {
if (enc == parser->m_encoding) {
+27 -33
View File
@@ -1,94 +1,88 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -3458,6 +3458,9 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -3939,6 +3939,9 @@
int n;
XML_Char *uri;
int nPrefixes = 0;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ int nXMLNSDeclarations = 0;
+/* END MOZILLA CHANGE */
+#endif
BINDING *binding;
const XML_Char *localPart;
@@ -3615,7 +3618,15 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -4096,7 +4099,13 @@
appAtts[attIndex], bindingsPtr);
if (result)
return result;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#if 0
--attIndex;
+#else
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ attIndex++;
+ nXMLNSDeclarations++;
+ (attId->name)[-1] = 3;
+#else
--attIndex;
+#endif
+/* END MOZILLA CHANGE */
} else {
/* deal with other prefixed names later */
attIndex++;
@@ -3647,6 +3658,12 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -4128,6 +4137,12 @@
da->value, bindingsPtr);
if (result)
return result;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ (da->id->name)[-1] = 3;
+ nXMLNSDeclarations++;
+ appAtts[attIndex++] = da->id->name;
+ appAtts[attIndex++] = da->value;
+/* END MOZILLA CHANGE */
+#endif
} else {
(da->id->name)[-1] = 2;
nPrefixes++;
@@ -3665,7 +3682,13 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -4146,7 +4161,11 @@
/* expand prefixed attribute names, check for duplicates,
and clear flags that say whether attributes were specified */
i = 0;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#if 0
if (nPrefixes) {
+#else
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ if (nPrefixes || nXMLNSDeclarations) {
+#else
if (nPrefixes) {
+#endif
+/* END MOZILLA CHANGE */
int j; /* hash table index */
unsigned int j; /* hash table index */
unsigned long version = parser->m_nsAttsVersion;
@@ -3675,6 +3698,9 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -4156,6 +4175,9 @@
}
unsigned int nsAttsSize = 1u << parser->m_nsAttsPower;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ if (nPrefixes) {
+/* END MOZILLA CHANGE */
+#endif
unsigned char oldNsAttsPower = parser->m_nsAttsPower;
/* size of hash table must be at least 2 * (# of prefixed attributes) */
if ((nPrefixes << 1)
@@ -3724,6 +3750,9 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -4204,6 +4226,9 @@
parser->m_nsAtts[--j].version = version;
}
parser->m_nsAttsVersion = --version;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ }
+/* END MOZILLA CHANGE */
+#endif
/* expand prefixed names and check for duplicates */
for (; i < attIndex; i += 2) {
@@ -3823,10 +3852,63 @@ storeAtts(XML_Parser parser, const ENCOD
@@ -4303,10 +4328,61 @@
parser->m_nsAtts[j].hash = uriHash;
parser->m_nsAtts[j].uriName = s;
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#if 0
if (! --nPrefixes) {
+#else
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array) */
+ if (! --nPrefixes && ! nXMLNSDeclarations) {
+#else
if (! --nPrefixes) {
+#endif
+/* END MOZILLA CHANGE */
i += 2;
break;
}
+/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
+#ifdef MOZILLA_CLIENT /* Include xmlns attributes in attributes array */
+ } else if (s[-1] == 3) { /* xmlns attribute */
+ static const XML_Char xmlnsNamespace[] = {
+ ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
@@ -134,7 +128,7 @@ diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+ i += 2;
+ break;
+ }
+/* END MOZILLA CHANGE */
+#endif
} else /* not prefixed */
((XML_Char *)s)[-1] = 0; /* clear flag */
}
+4 -6
View File
@@ -1,17 +1,15 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -5752,7 +5752,13 @@ doProlog(XML_Parser parser, const ENCODI
@@ -6231,7 +6231,11 @@
entity->open = XML_TRUE;
entityTrackingOnOpen(parser, entity, __LINE__);
if (! parser->m_externalEntityRefHandler(
+/* BEGIN MOZILLA CHANGE (Bug 191482 - Add external entity inclusions to internalSubset) */
+#if 0
parser->m_externalEntityRefHandlerArg, 0, entity->base,
+#else
+#ifdef MOZILLA_CLIENT /* Bug 191482 - Add external entity inclusions to internalSubset */
+ parser->m_externalEntityRefHandlerArg, entity->name, entity->base,
+#else
parser->m_externalEntityRefHandlerArg, 0, entity->base,
+#endif
+/* END MOZILLA CHANGE */
entity->systemId, entity->publicId)) {
entityTrackingOnClose(parser, entity, __LINE__);
entity->open = XML_FALSE;
+12 -7
View File
@@ -1,28 +1,33 @@
diff --git a/lib/xmltok.c b/lib/xmltok.c
--- a/lib/xmltok.c
+++ b/lib/xmltok.c
@@ -1148,6 +1148,10 @@ static const char KW_yes[] = {ASCII_y, A
@@ -1148,6 +1148,12 @@
static const char KW_no[] = {ASCII_n, ASCII_o, '\0'};
+/* BEGIN MOZILLA CHANGE (Bug 62157 - Document content is rendered even though version value is not "1.0") */
+#ifdef MOZILLA_CLIENT
+/* Bug 62157 - Document content is rendered even though version value is
+ not "1.0" */
+static const char KW_XML_1_0[] = {ASCII_1, ASCII_PERIOD, ASCII_0, '\0'};
+/* END MOZILLA CHANGE */
+#endif
+
static int
doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *,
const char *),
@@ -1175,6 +1179,13 @@ doParseXmlDecl(const ENCODING *(*encodin
@@ -1175,6 +1181,16 @@
*versionPtr = val;
if (versionEndPtr)
*versionEndPtr = ptr;
+/* BEGIN MOZILLA CHANGE (Bug 62157 - Document content is rendered even though version value is not "1.0") */
+ /* Anything else but a version="1.0" is invalid for us, until we support later versions. */
+#ifdef MOZILLA_CLIENT
+/* Bug 62157 - Document content is rendered even though version value is
+ not "1.0") */
+ /* Anything else but a version="1.0" is invalid for us, until we support
+ later versions. */
+ if (!XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_XML_1_0)) {
+ *badPtr = val;
+ return 0;
+ }
+/* END MOZILLA CHANGE */
+#endif
if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
*badPtr = ptr;
return 0;
+59 -72
View File
@@ -1,218 +1,205 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -444,16 +444,24 @@ typedef unsigned long long XmlBigCount;
@@ -453,7 +453,9 @@
typedef struct accounting {
XmlBigCount countBytesDirect;
XmlBigCount countBytesIndirect;
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
unsigned long debugLevel;
+#endif
+/* END MOZILLA CHANGE */
float maximumAmplificationFactor; // >=1.0
unsigned long long activationThresholdBytes;
} ACCOUNTING;
@@ -466,12 +468,14 @@
XmlBigCount activationThresholdBytes;
} MALLOC_TRACKER;
+#ifndef MOZILLA_CLIENT /* don't report debug information */
typedef struct entity_stats {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
unsigned int countEverOpened;
unsigned int currentDepth;
unsigned int maximumDepthSeen;
unsigned long debugLevel;
+#endif
+/* END MOZILLA CHANGE */
} ENTITY_STATS;
+#endif /* MOZILLA_CLIENT */
#endif /* XML_GE == 1 */
@@ -611,18 +619,26 @@ static void parserInit(XML_Parser parser
typedef enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start,
@@ -632,18 +636,22 @@
static float accountingGetCurrentAmplification(XML_Parser rootParser);
static void accountingReportStats(XML_Parser originParser, const char *epilog);
static void accountingOnAbort(XML_Parser originParser);
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
static void accountingReportDiff(XML_Parser rootParser,
unsigned int levelsAwayFromRootParser,
const char *before, const char *after,
ptrdiff_t bytesMore, int source_line,
enum XML_Account account);
+#endif
+/* END MOZILLA CHANGE */
static XML_Bool accountingDiffTolerated(XML_Parser originParser, int tok,
const char *before, const char *after,
int source_line,
enum XML_Account account);
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
static void entityTrackingReportStats(XML_Parser parser, ENTITY *entity,
const char *action, int sourceLine);
+#endif
+/* END MOZILLA CHANGE */
static void entityTrackingOnOpen(XML_Parser parser, ENTITY *entity,
int sourceLine);
static void entityTrackingOnClose(XML_Parser parser, ENTITY *entity,
@@ -632,8 +648,12 @@ static XML_Parser getRootParserOf(XML_Pa
@@ -653,8 +661,10 @@
static XML_Parser getRootParserOf(XML_Parser parser,
unsigned int *outLevelDiff);
#endif /* XML_GE == 1 */
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
static unsigned long getDebugLevel(const char *variableName,
unsigned long defaultDebugLevel);
+#endif
+/* END MOZILLA CHANGE */
#define poolStart(pool) ((pool)->start)
#define poolLength(pool) ((pool)->ptr - (pool)->start)
@@ -1292,15 +1312,23 @@ parserInit(XML_Parser parser, const XML_
@@ -795,8 +805,10 @@
#if XML_GE == 1
ACCOUNTING m_accounting;
MALLOC_TRACKER m_alloc_tracker;
+#ifndef MOZILLA_CLIENT /* don't report debug information */
ENTITY_STATS m_entity_stats;
-#endif
+#endif /* MOZILLA_CLIENT */
+#endif /* XML_GE == 1 */
#ifdef MOZILLA_CLIENT /* Report opening tag of mismatched closing tag */
const XML_Char* m_mismatch;
#endif
@@ -1638,15 +1650,19 @@
#if XML_GE == 1
memset(&parser->m_accounting, 0, sizeof(ACCOUNTING));
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
parser->m_accounting.debugLevel = getDebugLevel("EXPAT_ACCOUNTING_DEBUG", 0u);
+#endif
+/* END MOZILLA CHANGE */
parser->m_accounting.maximumAmplificationFactor
= EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT;
parser->m_accounting.activationThresholdBytes
= EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT;
+#ifndef MOZILLA_CLIENT /* don't report debug information */
memset(&parser->m_entity_stats, 0, sizeof(ENTITY_STATS));
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
parser->m_entity_stats.debugLevel = getDebugLevel("EXPAT_ENTITY_DEBUG", 0u);
#endif
+/* END MOZILLA CHANGE */
+#endif
-#endif
+#endif /* MOZILLA_CLIENT */
+#endif /* XML_GE == 1 */
}
/* moves list of bindings to m_freeBindingList */
@@ -8069,6 +8097,8 @@ accountingGetCurrentAmplification(XML_Pa
@@ -8668,6 +8684,7 @@
static void
accountingReportStats(XML_Parser originParser, const char *epilog) {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
const XML_Parser rootParser = getRootParserOf(originParser, NULL);
assert(! rootParser->m_parentParser);
@@ -8084,6 +8114,8 @@ accountingReportStats(XML_Parser originP
@@ -8683,6 +8700,7 @@
(void *)rootParser, rootParser->m_accounting.countBytesDirect,
rootParser->m_accounting.countBytesIndirect,
(double)amplificationFactor, epilog);
+#endif
+/* END MOZILLA CHANGE */
}
static void
@@ -8091,6 +8123,8 @@ accountingOnAbort(XML_Parser originParse
@@ -8690,6 +8708,7 @@
accountingReportStats(originParser, " ABORTING\n");
}
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
static void
accountingReportDiff(XML_Parser rootParser,
unsigned int levelsAwayFromRootParser, const char *before,
@@ -8127,6 +8161,8 @@ accountingReportDiff(XML_Parser rootPars
@@ -8726,6 +8745,7 @@
}
fprintf(stderr, "\"\n");
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
static XML_Bool
accountingDiffTolerated(XML_Parser originParser, int tok, const char *before,
@@ -8174,11 +8210,15 @@ accountingDiffTolerated(XML_Parser origi
@@ -8773,11 +8793,13 @@
|| (amplificationFactor
<= rootParser->m_accounting.maximumAmplificationFactor);
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
if (rootParser->m_accounting.debugLevel >= 2u) {
accountingReportStats(rootParser, "");
accountingReportDiff(rootParser, levelsAwayFromRootParser, before, after,
bytesMore, source_line, account);
}
+#endif
+/* END MOZILLA CHANGE */
return tolerated;
}
@@ -8197,6 +8237,8 @@ testingAccountingGetCountBytesIndirect(X
@@ -8796,6 +8818,7 @@
return parser->m_accounting.countBytesIndirect;
}
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
static void
entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity,
const char *action, int sourceLine) {
@@ -8220,9 +8262,13 @@ entityTrackingReportStats(XML_Parser roo
@@ -8819,9 +8842,11 @@
entity->is_param ? "%" : "&", entityName, action, entity->textLen,
sourceLine);
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
static void
entityTrackingOnOpen(XML_Parser originParser, ENTITY *entity, int sourceLine) {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
const XML_Parser rootParser = getRootParserOf(originParser, NULL);
assert(! rootParser->m_parentParser);
@@ -8234,15 +8280,21 @@ entityTrackingOnOpen(XML_Parser originPa
@@ -8833,15 +8858,18 @@
}
entityTrackingReportStats(rootParser, entity, "OPEN ", sourceLine);
+#endif
+/* END MOZILLA CHANGE */
}
static void
entityTrackingOnClose(XML_Parser originParser, ENTITY *entity, int sourceLine) {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
const XML_Parser rootParser = getRootParserOf(originParser, NULL);
assert(! rootParser->m_parentParser);
entityTrackingReportStats(rootParser, entity, "CLOSE", sourceLine);
rootParser->m_entity_stats.currentDepth--;
+#endif
+/* END MOZILLA CHANGE */
}
static XML_Parser
@@ -8260,6 +8312,8 @@ getRootParserOf(XML_Parser parser, unsig
return rootParser;
}
#endif /* XML_GE == 1 */
@@ -8863,6 +8891,7 @@
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
#if XML_GE == 1
+#ifndef MOZILLA_CLIENT /* don't report debug information */
const char *
unsignedCharToPrintable(unsigned char c) {
switch (c) {
@@ -8781,9 +8835,13 @@ unsignedCharToPrintable(unsigned char c)
}
@@ -9386,9 +9415,11 @@
assert(0); /* never gets here */
// LCOV_EXCL_STOP
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
#endif /* XML_GE == 1 */
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
+#ifndef MOZILLA_CLIENT /* don't report debug information */
static unsigned long
getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) {
const char *const valueOrNull = getenv(variableName);
@@ -8802,3 +8860,5 @@ getDebugLevel(const char *variableName,
@@ -9407,3 +9438,4 @@
return debugLevel;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
+76 -97
View File
@@ -1,262 +1,241 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -564,8 +564,12 @@ static XML_Bool setContext(XML_Parser pa
@@ -582,8 +582,10 @@
static void FASTCALL normalizePublicId(XML_Char *s);
static DTD *dtdCreate(const XML_Memory_Handling_Suite *ms);
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
static DTD *dtdCreate(XML_Parser parser);
+#ifndef MOZILLA_CLIENT /* unused API */
/* do not call if m_parentParser != NULL */
static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms);
static void dtdReset(DTD *p, XML_Parser parser);
+#endif
+/* END MOZILLA CHANGE */
static void dtdDestroy(DTD *p, XML_Bool isDocEntity,
const XML_Memory_Handling_Suite *ms);
static void dtdDestroy(DTD *p, XML_Bool isDocEntity, XML_Parser parser);
static int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd,
@@ -576,7 +580,11 @@ static NAMED *lookup(XML_Parser parser,
XML_Parser parser);
@@ -592,7 +594,9 @@
static NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name,
size_t createSize);
static void FASTCALL hashTableInit(HASH_TABLE *table,
const XML_Memory_Handling_Suite *ms);
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
static void FASTCALL hashTableInit(HASH_TABLE *table, XML_Parser parser);
+#ifndef MOZILLA_CLIENT /* unused API */
static void FASTCALL hashTableClear(HASH_TABLE *table);
+#endif
+/* END MOZILLA CHANGE */
static void FASTCALL hashTableDestroy(HASH_TABLE *table);
static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *iter,
const HASH_TABLE *table);
@@ -800,6 +808,8 @@ struct XML_ParserStruct {
#define REALLOC(parser, p, s) (parser->m_mem.realloc_fcn((p), (s)))
#define FREE(parser, p) (parser->m_mem.free_fcn((p)))
@@ -1042,6 +1046,7 @@
}
#endif // XML_GE == 1
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
XML_Parser XMLCALL
XML_ParserCreate(const XML_Char *encodingName) {
return XML_ParserCreate_MM(encodingName, NULL, NULL);
@@ -810,6 +820,8 @@ XML_ParserCreateNS(const XML_Char *encod
@@ -1052,6 +1057,7 @@
XML_Char tmp[2] = {nsSep, 0};
return XML_ParserCreate_MM(encodingName, NULL, tmp);
}
+#endif
+/* END MOZILLA CHANGE */
// "xml=http://www.w3.org/XML/1998/namespace"
static const XML_Char implicitContext[]
@@ -1331,6 +1343,8 @@ parserInit(XML_Parser parser, const XML_
#endif
@@ -1665,6 +1671,7 @@
#endif /* XML_GE == 1 */
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
/* moves list of bindings to m_freeBindingList */
static void FASTCALL
moveToFreeBindingList(XML_Parser parser, BINDING *bindings) {
@@ -1409,6 +1423,8 @@ XML_SetEncoding(XML_Parser parser, const
@@ -1773,6 +1780,7 @@
}
return XML_STATUS_OK;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
XML_Parser XMLCALL
XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context,
@@ -1665,6 +1681,8 @@ XML_UseParserAsHandlerArg(XML_Parser par
@@ -2059,6 +2067,7 @@
parser->m_handlerArg = parser;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
enum XML_Error XMLCALL
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) {
if (parser == NULL)
@@ -1681,6 +1699,8 @@ XML_UseForeignDTD(XML_Parser parser, XML
@@ -2072,8 +2081,9 @@
#else
UNUSED_P(useDTD);
return XML_ERROR_FEATURE_REQUIRES_XML_DTD;
#endif
-#endif
+#endif /* XML_DTD */
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
void XMLCALL
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {
@@ -1756,6 +1776,8 @@ XML_SetElementHandler(XML_Parser parser,
@@ -2148,6 +2158,7 @@
parser->m_endElementHandler = end;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
void XMLCALL
XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) {
if (parser != NULL)
@@ -1767,6 +1789,8 @@ XML_SetEndElementHandler(XML_Parser pars
@@ -2159,6 +2170,7 @@
if (parser != NULL)
parser->m_endElementHandler = end;
}
+#endif
+/* END MOZILLA CHANGE */
void XMLCALL
XML_SetCharacterDataHandler(XML_Parser parser,
@@ -1798,6 +1822,8 @@ XML_SetCdataSectionHandler(XML_Parser pa
@@ -2190,6 +2202,7 @@
parser->m_endCdataSectionHandler = end;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
void XMLCALL
XML_SetStartCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start) {
@@ -1819,6 +1845,8 @@ XML_SetDefaultHandler(XML_Parser parser,
@@ -2211,6 +2224,7 @@
parser->m_defaultHandler = handler;
parser->m_defaultExpandInternalEntities = XML_FALSE;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
void XMLCALL
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) {
@@ -1837,6 +1865,8 @@ XML_SetDoctypeDeclHandler(XML_Parser par
@@ -2229,6 +2243,7 @@
parser->m_endDoctypeDeclHandler = end;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
void XMLCALL
XML_SetStartDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start) {
@@ -1849,6 +1879,8 @@ XML_SetEndDoctypeDeclHandler(XML_Parser
@@ -2241,6 +2256,7 @@
if (parser != NULL)
parser->m_endDoctypeDeclHandler = end;
}
+#endif
+/* END MOZILLA CHANGE */
void XMLCALL
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
@@ -1873,6 +1905,8 @@ XML_SetNamespaceDeclHandler(XML_Parser p
@@ -2265,6 +2281,7 @@
parser->m_endNamespaceDeclHandler = end;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
void XMLCALL
XML_SetStartNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start) {
@@ -1893,6 +1927,8 @@ XML_SetNotStandaloneHandler(XML_Parser p
@@ -2285,6 +2302,7 @@
if (parser != NULL)
parser->m_notStandaloneHandler = handler;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
void XMLCALL
XML_SetExternalEntityRefHandler(XML_Parser parser,
@@ -1911,6 +1947,8 @@ XML_SetExternalEntityRefHandlerArg(XML_P
@@ -2303,6 +2321,7 @@
parser->m_externalEntityRefHandlerArg = parser;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
void XMLCALL
XML_SetSkippedEntityHandler(XML_Parser parser,
XML_SkippedEntityHandler handler) {
@@ -1944,6 +1982,8 @@ XML_SetEntityDeclHandler(XML_Parser pars
@@ -2336,6 +2355,7 @@
if (parser != NULL)
parser->m_entityDeclHandler = handler;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
void XMLCALL
XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) {
@@ -2401,6 +2441,8 @@ XML_GetCurrentByteIndex(XML_Parser parse
/* END MOZILLA CHANGE */
@@ -2804,6 +2824,7 @@
#endif
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
int XMLCALL
XML_GetCurrentByteCount(XML_Parser parser) {
if (parser == NULL)
@@ -2429,6 +2471,8 @@ XML_GetInputContext(XML_Parser parser, i
@@ -2832,6 +2853,7 @@
#endif /* XML_CONTEXT_BYTES > 0 */
return (const char *)0;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
XML_Size XMLCALL
XML_GetCurrentLineNumber(XML_Parser parser) {
@@ -2454,6 +2498,8 @@ XML_GetCurrentColumnNumber(XML_Parser pa
@@ -2857,6 +2879,7 @@
return parser->m_position.columnNumber;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
void XMLCALL
XML_FreeContentModel(XML_Parser parser, XML_Content *model) {
if (parser != NULL)
@@ -2682,6 +2728,8 @@ XML_GetFeatureList(void) {
if (parser == NULL)
@@ -3102,11 +3125,12 @@
{XML_FEATURE_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT,
XML_L("XML_AT_ACT_THRES"),
(long int)EXPAT_ALLOC_TRACKER_ACTIVATION_THRESHOLD_DEFAULT},
-#endif
+#endif /* XML_GE == 1 */
{XML_FEATURE_END, NULL, 0}};
return features;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
#if XML_GE == 1
XML_Bool XMLCALL
@@ -7146,6 +7194,8 @@ dtdCreate(const XML_Memory_Handling_Suit
@@ -7727,6 +7751,7 @@
return p;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
static void
dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) {
dtdReset(DTD *p, XML_Parser parser) {
HASH_TABLE_ITER iter;
@@ -7186,6 +7236,8 @@ dtdReset(DTD *p, const XML_Memory_Handli
@@ -7767,6 +7792,7 @@
p->hasParamEntityRefs = XML_FALSE;
p->standalone = XML_FALSE;
}
+#endif
+/* END MOZILLA CHANGE */
+#endif /* MOZILLA_CLIENT */
static void
dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) {
@@ -7540,6 +7592,8 @@ lookup(XML_Parser parser, HASH_TABLE *ta
dtdDestroy(DTD *p, XML_Bool isDocEntity, XML_Parser parser) {
@@ -8121,6 +8147,7 @@
return table->v[i];
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
static void FASTCALL
hashTableClear(HASH_TABLE *table) {
size_t i;
@@ -7549,6 +7603,8 @@ hashTableClear(HASH_TABLE *table) {
@@ -8130,6 +8157,7 @@
}
table->used = 0;
}
+#endif
+/* END MOZILLA CHANGE */
static void FASTCALL
hashTableDestroy(HASH_TABLE *table) {
@@ -8223,6 +8279,8 @@ accountingDiffTolerated(XML_Parser origi
@@ -8804,6 +8832,7 @@
return tolerated;
}
+/* BEGIN MOZILLA CHANGE (unused API) */
+#if 0
+#ifndef MOZILLA_CLIENT /* unused API */
unsigned long long
testingAccountingGetCountBytesDirect(XML_Parser parser) {
if (! parser)
@@ -8236,6 +8294,8 @@ testingAccountingGetCountBytesIndirect(X
@@ -8817,6 +8846,7 @@
return 0;
return parser->m_accounting.countBytesIndirect;
}
+#endif
+/* END MOZILLA CHANGE */
/* BEGIN MOZILLA CHANGE (don't report debug information) */
#if 0
#ifndef MOZILLA_CLIENT /* don't report debug information */
static void
+30
View File
@@ -0,0 +1,30 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -1443,8 +1443,10 @@
// Initialize .m_alloc_tracker
memset(&parser->m_alloc_tracker, 0, sizeof(MALLOC_TRACKER));
if (parentParser == NULL) {
+#ifndef MOZILLA_CLIENT /* don't report debug information */
parser->m_alloc_tracker.debugLevel
= getDebugLevel("EXPAT_MALLOC_DEBUG", 0u);
+#endif
parser->m_alloc_tracker.maximumAmplificationFactor
= EXPAT_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT;
parser->m_alloc_tracker.activationThresholdBytes
@@ -1741,6 +1743,7 @@
dtdReset(parser->m_dtd, parser);
return XML_TRUE;
}
+#endif /* MOZILLA_CLIENT */
static XML_Bool
parserBusy(XML_Parser parser) {
@@ -1755,6 +1758,7 @@
}
}
+#ifndef MOZILLA_CLIENT /* unused API */
enum XML_Status XMLCALL
XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) {
if (parser == NULL)
-106
View File
@@ -1,106 +0,0 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -453,16 +453,16 @@
unsigned long long activationThresholdBytes;
} ACCOUNTING;
-typedef struct entity_stats {
-/* BEGIN MOZILLA CHANGE (don't report debug information) */
+/* BEGIN MCP CHANGE (don't report debug information) */
#if 0
+typedef struct entity_stats {
unsigned int countEverOpened;
unsigned int currentDepth;
unsigned int maximumDepthSeen;
unsigned long debugLevel;
-#endif
-/* END MOZILLA CHANGE */
} ENTITY_STATS;
+#endif
+/* END MCP CHANGE */
#endif /* XML_GE == 1 */
typedef enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start,
@@ -614,7 +614,11 @@
static XML_Char *copyString(const XML_Char *s,
const XML_Memory_Handling_Suite *memsuite);
+/* BEGIN MCP CHANGE (we already set a salt through XML_SetHashSalt) */
+#if 0
static unsigned long generate_hash_secret_salt(XML_Parser parser);
+#endif
+/* END MCP CHANGE */
static XML_Bool startParsing(XML_Parser parser);
static XML_Parser parserCreate(const XML_Char *encodingName,
@@ -797,8 +801,12 @@
unsigned long m_hash_secret_salt;
#if XML_GE == 1
ACCOUNTING m_accounting;
+/* BEGIN MCP CHANGE (don't report debug information) */
+#if 0
ENTITY_STATS m_entity_stats;
#endif
+/* END MCP CHANGE */
+#endif
/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
const XML_Char* m_mismatch;
/* END MOZILLA CHANGE */
@@ -1001,10 +1009,10 @@
#endif
/* END MOZILLA CHANGE */
+/* BEGIN MCP CHANGE (we already set a salt through XML_SetHashSalt) */
+#if 0
static unsigned long
generate_hash_secret_salt(XML_Parser parser) {
-/* BEGIN MOZILLA CHANGE (we already set a salt through XML_SetHashSalt) */
-#if 0
unsigned long entropy;
(void)parser;
@@ -1044,11 +1052,9 @@
entropy * (unsigned long)2305843009213693951ULL);
}
#endif
-#else
- abort();
-#endif
-/* END MOZILLA CHANGE */
}
+#endif
+/* END MCP CHANGE */
static unsigned long
get_hash_secret_salt(XML_Parser parser) {
@@ -1102,9 +1108,13 @@
static XML_Bool /* only valid for root parser */
startParsing(XML_Parser parser) {
+/* BEGIN MCP CHANGE (we already set a salt through XML_SetHashSalt) */
+#if 0
/* hash functions must be initialized before setContext() is called */
if (parser->m_hash_secret_salt == 0)
parser->m_hash_secret_salt = generate_hash_secret_salt(parser);
+#endif
+/* END MCP CHANGE */
if (parser->m_ns) {
/* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it
@@ -1334,12 +1344,12 @@
parser->m_accounting.activationThresholdBytes
= EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT;
- memset(&parser->m_entity_stats, 0, sizeof(ENTITY_STATS));
-/* BEGIN MOZILLA CHANGE (don't report debug information) */
+/* BEGIN MCP CHANGE (don't report debug information) */
#if 0
+ memset(&parser->m_entity_stats, 0, sizeof(ENTITY_STATS));
parser->m_entity_stats.debugLevel = getDebugLevel("EXPAT_ENTITY_DEBUG", 0u);
#endif
-/* END MOZILLA CHANGE */
+/* END MCP CHANGE */
#endif
}
+1 -1
View File
@@ -9,4 +9,4 @@ The upstream expat git repository is:
https://github.com/libexpat/libexpat
The version used was tagged release version 2.6.4.
The version used was tagged release version 2.7.3.