13_no_debug_report.patch (7539B)
1 diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c 2 --- a/expat/lib/xmlparse.c 3 +++ b/expat/lib/xmlparse.c 4 @@ -444,16 +444,24 @@ typedef unsigned long long XmlBigCount; 5 typedef struct accounting { 6 XmlBigCount countBytesDirect; 7 XmlBigCount countBytesIndirect; 8 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 9 +#if 0 10 unsigned long debugLevel; 11 +#endif 12 +/* END MOZILLA CHANGE */ 13 float maximumAmplificationFactor; // >=1.0 14 unsigned long long activationThresholdBytes; 15 } ACCOUNTING; 16 17 typedef struct entity_stats { 18 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 19 +#if 0 20 unsigned int countEverOpened; 21 unsigned int currentDepth; 22 unsigned int maximumDepthSeen; 23 unsigned long debugLevel; 24 +#endif 25 +/* END MOZILLA CHANGE */ 26 } ENTITY_STATS; 27 #endif /* XML_GE == 1 */ 28 29 @@ -611,18 +619,26 @@ static void parserInit(XML_Parser parser 30 static float accountingGetCurrentAmplification(XML_Parser rootParser); 31 static void accountingReportStats(XML_Parser originParser, const char *epilog); 32 static void accountingOnAbort(XML_Parser originParser); 33 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 34 +#if 0 35 static void accountingReportDiff(XML_Parser rootParser, 36 unsigned int levelsAwayFromRootParser, 37 const char *before, const char *after, 38 ptrdiff_t bytesMore, int source_line, 39 enum XML_Account account); 40 +#endif 41 +/* END MOZILLA CHANGE */ 42 static XML_Bool accountingDiffTolerated(XML_Parser originParser, int tok, 43 const char *before, const char *after, 44 int source_line, 45 enum XML_Account account); 46 47 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 48 +#if 0 49 static void entityTrackingReportStats(XML_Parser parser, ENTITY *entity, 50 const char *action, int sourceLine); 51 +#endif 52 +/* END MOZILLA CHANGE */ 53 static void entityTrackingOnOpen(XML_Parser parser, ENTITY *entity, 54 int sourceLine); 55 static void entityTrackingOnClose(XML_Parser parser, ENTITY *entity, 56 @@ -632,8 +648,12 @@ static XML_Parser getRootParserOf(XML_Pa 57 unsigned int *outLevelDiff); 58 #endif /* XML_GE == 1 */ 59 60 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 61 +#if 0 62 static unsigned long getDebugLevel(const char *variableName, 63 unsigned long defaultDebugLevel); 64 +#endif 65 +/* END MOZILLA CHANGE */ 66 67 #define poolStart(pool) ((pool)->start) 68 #define poolLength(pool) ((pool)->ptr - (pool)->start) 69 @@ -1292,15 +1312,23 @@ parserInit(XML_Parser parser, const XML_ 70 71 #if XML_GE == 1 72 memset(&parser->m_accounting, 0, sizeof(ACCOUNTING)); 73 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 74 +#if 0 75 parser->m_accounting.debugLevel = getDebugLevel("EXPAT_ACCOUNTING_DEBUG", 0u); 76 +#endif 77 +/* END MOZILLA CHANGE */ 78 parser->m_accounting.maximumAmplificationFactor 79 = EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT; 80 parser->m_accounting.activationThresholdBytes 81 = EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT; 82 83 memset(&parser->m_entity_stats, 0, sizeof(ENTITY_STATS)); 84 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 85 +#if 0 86 parser->m_entity_stats.debugLevel = getDebugLevel("EXPAT_ENTITY_DEBUG", 0u); 87 #endif 88 +/* END MOZILLA CHANGE */ 89 +#endif 90 } 91 92 /* moves list of bindings to m_freeBindingList */ 93 @@ -8069,6 +8097,8 @@ accountingGetCurrentAmplification(XML_Pa 94 95 static void 96 accountingReportStats(XML_Parser originParser, const char *epilog) { 97 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 98 +#if 0 99 const XML_Parser rootParser = getRootParserOf(originParser, NULL); 100 assert(! rootParser->m_parentParser); 101 102 @@ -8084,6 +8114,8 @@ accountingReportStats(XML_Parser originP 103 (void *)rootParser, rootParser->m_accounting.countBytesDirect, 104 rootParser->m_accounting.countBytesIndirect, 105 (double)amplificationFactor, epilog); 106 +#endif 107 +/* END MOZILLA CHANGE */ 108 } 109 110 static void 111 @@ -8091,6 +8123,8 @@ accountingOnAbort(XML_Parser originParse 112 accountingReportStats(originParser, " ABORTING\n"); 113 } 114 115 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 116 +#if 0 117 static void 118 accountingReportDiff(XML_Parser rootParser, 119 unsigned int levelsAwayFromRootParser, const char *before, 120 @@ -8127,6 +8161,8 @@ accountingReportDiff(XML_Parser rootPars 121 } 122 fprintf(stderr, "\"\n"); 123 } 124 +#endif 125 +/* END MOZILLA CHANGE */ 126 127 static XML_Bool 128 accountingDiffTolerated(XML_Parser originParser, int tok, const char *before, 129 @@ -8174,11 +8210,15 @@ accountingDiffTolerated(XML_Parser origi 130 || (amplificationFactor 131 <= rootParser->m_accounting.maximumAmplificationFactor); 132 133 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 134 +#if 0 135 if (rootParser->m_accounting.debugLevel >= 2u) { 136 accountingReportStats(rootParser, ""); 137 accountingReportDiff(rootParser, levelsAwayFromRootParser, before, after, 138 bytesMore, source_line, account); 139 } 140 +#endif 141 +/* END MOZILLA CHANGE */ 142 143 return tolerated; 144 } 145 @@ -8197,6 +8237,8 @@ testingAccountingGetCountBytesIndirect(X 146 return parser->m_accounting.countBytesIndirect; 147 } 148 149 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 150 +#if 0 151 static void 152 entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity, 153 const char *action, int sourceLine) { 154 @@ -8220,9 +8262,13 @@ entityTrackingReportStats(XML_Parser roo 155 entity->is_param ? "%" : "&", entityName, action, entity->textLen, 156 sourceLine); 157 } 158 +#endif 159 +/* END MOZILLA CHANGE */ 160 161 static void 162 entityTrackingOnOpen(XML_Parser originParser, ENTITY *entity, int sourceLine) { 163 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 164 +#if 0 165 const XML_Parser rootParser = getRootParserOf(originParser, NULL); 166 assert(! rootParser->m_parentParser); 167 168 @@ -8234,15 +8280,21 @@ entityTrackingOnOpen(XML_Parser originPa 169 } 170 171 entityTrackingReportStats(rootParser, entity, "OPEN ", sourceLine); 172 +#endif 173 +/* END MOZILLA CHANGE */ 174 } 175 176 static void 177 entityTrackingOnClose(XML_Parser originParser, ENTITY *entity, int sourceLine) { 178 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 179 +#if 0 180 const XML_Parser rootParser = getRootParserOf(originParser, NULL); 181 assert(! rootParser->m_parentParser); 182 183 entityTrackingReportStats(rootParser, entity, "CLOSE", sourceLine); 184 rootParser->m_entity_stats.currentDepth--; 185 +#endif 186 +/* END MOZILLA CHANGE */ 187 } 188 189 static XML_Parser 190 @@ -8260,6 +8312,8 @@ getRootParserOf(XML_Parser parser, unsig 191 return rootParser; 192 } 193 194 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 195 +#if 0 196 const char * 197 unsignedCharToPrintable(unsigned char c) { 198 switch (c) { 199 @@ -8781,9 +8835,13 @@ unsignedCharToPrintable(unsigned char c) 200 } 201 assert(0); /* never gets here */ 202 } 203 +#endif 204 +/* END MOZILLA CHANGE */ 205 206 #endif /* XML_GE == 1 */ 207 208 +/* BEGIN MOZILLA CHANGE (don't report debug information) */ 209 +#if 0 210 static unsigned long 211 getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) { 212 const char *const valueOrNull = getenv(variableName); 213 @@ -8802,3 +8860,5 @@ getDebugLevel(const char *variableName, 214 215 return debugLevel; 216 } 217 +#endif 218 +/* END MOZILLA CHANGE */