|
1 |
| -/* 628e24d4966bedbd4800f6ed128d06d29703765b4bce12d3b7f099f90f842fc9 (2.6.0+) |
| 1 | +/* dd2a9703e301882afe16d198a82689ab225277057f5eab9d079d8606eab736b4 (2.6.1+) |
2 | 2 | __ __ _
|
3 | 3 | ___\ \/ /_ __ __ _| |_
|
4 | 4 | / _ \\ /| '_ \ / _` | __|
|
|
38 | 38 | Copyright (c) 2022 Jann Horn <[email protected]>
|
39 | 39 | Copyright (c) 2022 Sean McBride <[email protected]>
|
40 | 40 | Copyright (c) 2023 Owain Davies <[email protected]>
|
41 |
| - Copyright (c) 2023 Sony Corporation / Snild Dolkow <[email protected]> |
| 41 | + Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <[email protected]> |
42 | 42 | Licensed under the MIT license:
|
43 | 43 |
|
44 | 44 | Permission is hereby granted, free of charge, to any person obtaining
|
@@ -217,7 +217,7 @@ typedef char ICHAR;
|
217 | 217 | #endif
|
218 | 218 |
|
219 | 219 | /* Round up n to be a multiple of sz, where sz is a power of 2. */
|
220 |
| -#define ROUND_UP(n, sz) (((n) + ((sz)-1)) & ~((sz)-1)) |
| 220 | +#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) |
221 | 221 |
|
222 | 222 | /* Do safe (NULL-aware) pointer arithmetic */
|
223 | 223 | #define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)
|
@@ -255,7 +255,7 @@ static void copy_salt_to_sipkey(XML_Parser parser, struct sipkey *key);
|
255 | 255 | it odd, since odd numbers are always relative prime to a power of 2.
|
256 | 256 | */
|
257 | 257 | #define SECOND_HASH(hash, mask, power) \
|
258 |
| - ((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2)) |
| 258 | + ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2)) |
259 | 259 | #define PROBE_STEP(hash, mask, power) \
|
260 | 260 | ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
|
261 | 261 |
|
@@ -636,8 +636,14 @@ static unsigned long getDebugLevel(const char *variableName,
|
636 | 636 | ? 0 \
|
637 | 637 | : ((*((pool)->ptr)++ = c), 1))
|
638 | 638 |
|
639 |
| -XML_Bool g_reparseDeferralEnabledDefault = XML_TRUE; // write ONLY in runtests.c |
640 |
| -unsigned int g_parseAttempts = 0; // used for testing only |
| 639 | +#if ! defined(XML_TESTING) |
| 640 | +const |
| 641 | +#endif |
| 642 | + XML_Bool g_reparseDeferralEnabledDefault |
| 643 | + = XML_TRUE; // write ONLY in runtests.c |
| 644 | +#if defined(XML_TESTING) |
| 645 | +unsigned int g_bytesScanned = 0; // used for testing only |
| 646 | +#endif |
641 | 647 |
|
642 | 648 | struct XML_ParserStruct {
|
643 | 649 | /* The first member must be m_userData so that the XML_GetUserData
|
@@ -1035,7 +1041,9 @@ callProcessor(XML_Parser parser, const char *start, const char *end,
|
1035 | 1041 | return XML_ERROR_NONE;
|
1036 | 1042 | }
|
1037 | 1043 | }
|
1038 |
| - g_parseAttempts += 1; |
| 1044 | +#if defined(XML_TESTING) |
| 1045 | + g_bytesScanned += (unsigned)have_now; |
| 1046 | +#endif |
1039 | 1047 | const enum XML_Error ret = parser->m_processor(parser, start, end, endPtr);
|
1040 | 1048 | if (ret == XML_ERROR_NONE) {
|
1041 | 1049 | // if we consumed nothing, remember what we had on this parse attempt.
|
|
0 commit comments