1 2 #include <php_compat.h> 3 4 #ifdef PHP_WIN32 5 # include <config.w32.h> 6 #else 7 # include <php_config.h> 8 #endif 9 10 #define SUPPORT_UNICODE 1 11 #define SUPPORT_PCRE2_8 1 12 13 #if defined(__GNUC__) && __GNUC__ >= 4 14 # ifdef __cplusplus 15 # define PCRE2_EXP_DECL extern "C" __attribute__ ((visibility("default"))) 16 # else 17 # define PCRE2_EXP_DECL extern __attribute__ ((visibility("default"))) 18 # endif 19 # define PCRE2_EXP_DEFN __attribute__ ((visibility("default"))) 20 #endif 21 22 /* Define to any value for valgrind support to find invalid memory reads. */ 23 #if HAVE_PCRE_VALGRIND_SUPPORT 24 #define SUPPORT_VALGRIND 1 25 #endif 26 27 /* Define to any value to enable support for Just-In-Time compiling. */ 28 #if HAVE_PCRE_JIT_SUPPORT 29 #define SUPPORT_JIT 30 #endif 31 32 /* This limits the amount of memory that pcre2_match() may use while matching 33 a pattern. The value is in kilobytes. */ 34 #ifndef HEAP_LIMIT 35 #define HEAP_LIMIT 20000000 36 #endif 37 38 /* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested 39 parentheses (of any kind) in a pattern. This limits the amount of system 40 stack that is used while compiling a pattern. */ 41 #ifndef PARENS_NEST_LIMIT 42 #define PARENS_NEST_LIMIT 250 43 #endif 44 45 /* The value of MATCH_LIMIT determines the default number of times the 46 pcre2_match() function can record a backtrack position during a single 47 matching attempt. There is a runtime interface for setting a different 48 limit. The limit exists in order to catch runaway regular expressions that 49 take for ever to determine that they do not match. The default is set very 50 large so that it does not accidentally catch legitimate cases. */ 51 #ifndef MATCH_LIMIT 52 #define MATCH_LIMIT 10000000 53 #endif 54 55 /* The above limit applies to all backtracks, whether or not they are nested. 56 In some environments it is desirable to limit the nesting of backtracking 57 (that is, the depth of tree that is searched) more strictly, in order to 58 restrict the maximum amount of heap memory that is used. The value of 59 MATCH_LIMIT_DEPTH provides this facility. To have any useful effect, it 60 must be less than the value of MATCH_LIMIT. The default is to use the same 61 value as MATCH_LIMIT. There is a runtime method for setting a different 62 limit. */ 63 #ifndef MATCH_LIMIT_DEPTH 64 #define MATCH_LIMIT_DEPTH MATCH_LIMIT 65 #endif 66 67 /* This limit is parameterized just in case anybody ever wants to change it. 68 Care must be taken if it is increased, because it guards against integer 69 overflow caused by enormously large patterns. */ 70 #ifndef MAX_NAME_COUNT 71 #define MAX_NAME_COUNT 10000 72 #endif 73 74 /* This limit is parameterized just in case anybody ever wants to change it. 75 Care must be taken if it is increased, because it guards against integer 76 overflow caused by enormously large patterns. */ 77 #ifndef MAX_NAME_SIZE 78 #define MAX_NAME_SIZE 32 79 #endif 80 81 /* Defining NEVER_BACKSLASH_C locks out the use of \C in all patterns. */ 82 /* #undef NEVER_BACKSLASH_C */ 83 84 /* The value of NEWLINE_DEFAULT determines the default newline character 85 sequence. PCRE2 client programs can override this by selecting other values 86 at run time. The valid values are 1 (CR), 2 (LF), 3 (CRLF), 4 (ANY), 5 87 (ANYCRLF), and 6 (NUL). */ 88 #ifndef NEWLINE_DEFAULT 89 #define NEWLINE_DEFAULT 2 90 #endif 91 92 /* The value of LINK_SIZE determines the number of bytes used to store links 93 as offsets within the compiled regex. The default is 2, which allows for 94 compiled patterns up to 64K long. This covers the vast majority of cases. 95 However, PCRE2 can also be compiled to use 3 or 4 bytes instead. This 96 allows for longer patterns in extreme cases. */ 97 #ifndef LINK_SIZE 98 #define LINK_SIZE 2 99 #endif 100 101