File: 11_no_debug_report.patch

package info (click to toggle)
firefox 149.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 4,767,760 kB
  • sloc: cpp: 7,416,064; javascript: 6,752,859; ansic: 3,774,850; python: 1,250,473; xml: 641,578; asm: 439,191; java: 186,617; sh: 56,634; makefile: 18,856; objc: 13,092; perl: 12,763; pascal: 5,960; yacc: 4,583; cs: 3,846; lex: 1,720; ruby: 1,002; php: 436; lisp: 258; awk: 105; sql: 66; sed: 53; csh: 10; exp: 6
file content (346 lines) | stat: -rw-r--r-- 12,791 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -456,24 +456,36 @@ typedef unsigned long long XmlBigCount;
 typedef struct accounting {
   XmlBigCount countBytesDirect;
   XmlBigCount countBytesIndirect;
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   unsigned long debugLevel;
+#endif
+/* END MOZILLA CHANGE */
   float maximumAmplificationFactor; // >=1.0
   unsigned long long activationThresholdBytes;
 } ACCOUNTING;
 
 typedef struct MALLOC_TRACKER {
   XmlBigCount bytesAllocated;
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#  if 0
   XmlBigCount peakBytesAllocated; // updated live only for debug level >=2
   unsigned long debugLevel;
+#endif
+/* END MOZILLA CHANGE */
   float maximumAmplificationFactor; // >=1.0
   XmlBigCount activationThresholdBytes;
 } MALLOC_TRACKER;
 
 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 /* XML_GE == 1 */
 
@@ -632,18 +644,26 @@ static void parserInit(XML_Parser parser, const XML_Char *encodingName);
 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
 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
 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,
@@ -653,8 +673,12 @@ static void entityTrackingOnClose(XML_Parser parser, ENTITY *entity,
 static XML_Parser getRootParserOf(XML_Parser parser,
                                   unsigned int *outLevelDiff);
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
 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)
@@ -814,6 +838,8 @@ struct XML_ParserStruct {
 #endif
 
 #if XML_GE == 1
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
 static void
 expat_heap_stat(XML_Parser rootParser, char operator, XmlBigCount absDiff,
                 XmlBigCount newTotal, XmlBigCount peakTotal, int sourceLine) {
@@ -827,6 +853,8 @@ expat_heap_stat(XML_Parser rootParser, char operator, XmlBigCount absDiff,
       (void *)rootParser, rootParser->m_accounting.countBytesDirect, operator,
       absDiff, newTotal, peakTotal, (double)amplification, sourceLine);
 }
+#endif
+/* END MOZILLA CHANGE */
 
 static bool
 expat_heap_increase_tolerable(XML_Parser rootParser, XmlBigCount increase,
@@ -855,9 +883,13 @@ expat_heap_increase_tolerable(XML_Parser rootParser, XmlBigCount increase,
     }
   }
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   if (! tolerable && (rootParser->m_alloc_tracker.debugLevel >= 1)) {
     expat_heap_stat(rootParser, '+', increase, newTotal, newTotal, sourceLine);
   }
+#endif
+/* END MOZILLA CHANGE */
 
   return tolerable;
 }
@@ -901,6 +933,8 @@ expat_malloc(XML_Parser parser, size_t size, int sourceLine) {
   // Update accounting
   rootParser->m_alloc_tracker.bytesAllocated += bytesToAllocate;
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   // Report as needed
   if (rootParser->m_alloc_tracker.debugLevel >= 2) {
     if (rootParser->m_alloc_tracker.bytesAllocated
@@ -912,6 +946,8 @@ expat_malloc(XML_Parser parser, size_t size, int sourceLine) {
                     rootParser->m_alloc_tracker.bytesAllocated,
                     rootParser->m_alloc_tracker.peakBytesAllocated, sourceLine);
   }
+#endif
+/* END MOZILLA CHANGE */
 
   return (char *)mallocedPtr + sizeof(size_t) + EXPAT_MALLOC_PADDING;
 }
@@ -941,12 +977,16 @@ expat_free(XML_Parser parser, void *ptr, int sourceLine) {
   assert(rootParser->m_alloc_tracker.bytesAllocated >= bytesAllocated);
   rootParser->m_alloc_tracker.bytesAllocated -= bytesAllocated;
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   // Report as needed
   if (rootParser->m_alloc_tracker.debugLevel >= 2) {
     expat_heap_stat(rootParser, '-', bytesAllocated,
                     rootParser->m_alloc_tracker.bytesAllocated,
                     rootParser->m_alloc_tracker.peakBytesAllocated, sourceLine);
   }
+#endif
+/* END MOZILLA CHANGE */
 
   // NOTE: This may be freeing rootParser, so freeing has to come last
   parser->m_mem.free_fcn(mallocedPtr);
@@ -1011,6 +1051,8 @@ expat_realloc(XML_Parser parser, void *ptr, size_t size, int sourceLine) {
     rootParser->m_alloc_tracker.bytesAllocated -= absDiff;
   }
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   // Report as needed
   if (rootParser->m_alloc_tracker.debugLevel >= 2) {
     if (rootParser->m_alloc_tracker.bytesAllocated
@@ -1022,6 +1064,8 @@ expat_realloc(XML_Parser parser, void *ptr, size_t size, int sourceLine) {
                     rootParser->m_alloc_tracker.bytesAllocated,
                     rootParser->m_alloc_tracker.peakBytesAllocated, sourceLine);
   }
+#endif
+/* END MOZILLA CHANGE */
 
   // Update in-block recorded size
   *(size_t *)mallocedPtr = size;
@@ -1431,8 +1475,12 @@ parserCreate(const XML_Char *encodingName,
   // Initialize .m_alloc_tracker
   memset(&parser->m_alloc_tracker, 0, sizeof(MALLOC_TRACKER));
   if (parentParser == NULL) {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
     parser->m_alloc_tracker.debugLevel
         = getDebugLevel("EXPAT_MALLOC_DEBUG", 0u);
+#endif
+/* END MOZILLA CHANGE */
     parser->m_alloc_tracker.maximumAmplificationFactor
         = EXPAT_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION_DEFAULT;
     parser->m_alloc_tracker.activationThresholdBytes
@@ -1452,6 +1500,8 @@ parserCreate(const XML_Char *encodingName,
   assert(SIZE_MAX - rootParser->m_alloc_tracker.bytesAllocated >= increase);
   rootParser->m_alloc_tracker.bytesAllocated += increase;
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   // Report on allocation
   if (rootParser->m_alloc_tracker.debugLevel >= 2) {
     if (rootParser->m_alloc_tracker.bytesAllocated
@@ -1464,6 +1514,8 @@ parserCreate(const XML_Char *encodingName,
                     rootParser->m_alloc_tracker.bytesAllocated,
                     rootParser->m_alloc_tracker.peakBytesAllocated, __LINE__);
   }
+#endif
+/* END MOZILLA CHANGE */
 #else
   parser->m_parentParser = NULL;
 #endif // XML_GE == 1
@@ -1644,15 +1696,23 @@ parserInit(XML_Parser parser, const XML_Char *encodingName) {
 
 #if XML_GE == 1
   memset(&parser->m_accounting, 0, sizeof(ACCOUNTING));
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   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;
 
   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
 }
 
 /* moves list of bindings to m_freeBindingList */
@@ -8667,6 +8727,8 @@ accountingGetCurrentAmplification(XML_Parser rootParser) {
 
 static void
 accountingReportStats(XML_Parser originParser, const char *epilog) {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   const XML_Parser rootParser = getRootParserOf(originParser, NULL);
   assert(! rootParser->m_parentParser);
 
@@ -8682,6 +8744,8 @@ accountingReportStats(XML_Parser originParser, const char *epilog) {
           (void *)rootParser, rootParser->m_accounting.countBytesDirect,
           rootParser->m_accounting.countBytesIndirect,
           (double)amplificationFactor, epilog);
+#endif
+/* END MOZILLA CHANGE */
 }
 
 static void
@@ -8689,6 +8753,8 @@ accountingOnAbort(XML_Parser originParser) {
   accountingReportStats(originParser, " ABORTING\n");
 }
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
 static void
 accountingReportDiff(XML_Parser rootParser,
                      unsigned int levelsAwayFromRootParser, const char *before,
@@ -8725,6 +8791,8 @@ accountingReportDiff(XML_Parser rootParser,
   }
   fprintf(stderr, "\"\n");
 }
+#endif
+/* END MOZILLA CHANGE */
 
 static XML_Bool
 accountingDiffTolerated(XML_Parser originParser, int tok, const char *before,
@@ -8772,11 +8840,15 @@ accountingDiffTolerated(XML_Parser originParser, int tok, const char *before,
         || (amplificationFactor
             <= rootParser->m_accounting.maximumAmplificationFactor);
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   if (rootParser->m_accounting.debugLevel >= 2u) {
     accountingReportStats(rootParser, "");
     accountingReportDiff(rootParser, levelsAwayFromRootParser, before, after,
                          bytesMore, source_line, account);
   }
+#endif
+/* END MOZILLA CHANGE */
 
   return tolerated;
 }
@@ -8795,6 +8867,8 @@ testingAccountingGetCountBytesIndirect(XML_Parser parser) {
   return parser->m_accounting.countBytesIndirect;
 }
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
 static void
 entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity,
                           const char *action, int sourceLine) {
@@ -8818,9 +8892,13 @@ entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity,
       entity->is_param ? "%" : "&", entityName, action, entity->textLen,
       sourceLine);
 }
+#endif
+/* END MOZILLA CHANGE */
 
 static void
 entityTrackingOnOpen(XML_Parser originParser, ENTITY *entity, int sourceLine) {
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
   const XML_Parser rootParser = getRootParserOf(originParser, NULL);
   assert(! rootParser->m_parentParser);
 
@@ -8832,15 +8910,21 @@ entityTrackingOnOpen(XML_Parser originParser, ENTITY *entity, int sourceLine) {
   }
 
   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
   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 */
 }
 
 #endif /* XML_GE == 1 */
@@ -8862,6 +8946,8 @@ getRootParserOf(XML_Parser parser, unsigned int *outLevelDiff) {
 
 #if XML_GE == 1
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
 const char *
 unsignedCharToPrintable(unsigned char c) {
   switch (c) {
@@ -9385,9 +9471,13 @@ unsignedCharToPrintable(unsigned char c) {
   assert(0); /* never gets here */
   // LCOV_EXCL_STOP
 }
+#endif
+/* END MOZILLA CHANGE */
 
 #endif /* XML_GE == 1 */
 
+/* BEGIN MOZILLA CHANGE (don't report debug information) */
+#if 0
 static unsigned long
 getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) {
   const char *const valueOrNull = getenv(variableName);
@@ -9406,3 +9496,5 @@ getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) {
 
   return debugLevel;
 }
+#endif
+/* END MOZILLA CHANGE */