https://bugs.exim.org/show_bug.cgi?id=2385
Mehmet gelisin <mehmetgeli...@aol.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mehmetgeli...@aol.com --- Comment #2 from Mehmet gelisin <mehmetgeli...@aol.com> --- PCRE's usage of stack space is documented in several places. Your example doesn't fail when using JIT optimization because JIT handles the stack differently. http://www.compilatori.com/ The function pcre_exec() uses an internal function match() which, by default, calls itself recursively when necessary. Each recursive call may use a few hundred bytes of a program's stack. http://www.logoarts.co.uk/ The amount of stack needed for each recursion varies by architecture and compiler. Other factors such as a compiler's debug build option may also have a large impact. http://www.slipstone.co.uk/ The following PCRE command provides an estimate of how much stack is needed for each recursion, and will also show the config setting for the maximum allowed recursion depth (10 million?). http://embermanchester.uk/ pcretest -m -C http://connstr.net/ Recent PCRE versions allow a recursion depth throttle to be specified at the beginning of an expression. With the following, PCRE will stop with an error (PCRE_ERROR_RECURSIONLIMIT = -21) when the specified recursion depth of 2500 is breached. http://joerg.li/ char const *re = "(*LIMIT_RECURSION=2500)0(?:(?!foo).)+"; You can increase the sample 2500 value and at some point the fault condition will happen again, somewhere below the 10000000 config default. http://www.jopspeech.com/ If you know how much stack space your program has available, and if you know about how many bytes each recursion uses, then you can estimate the depth where the exception will happen. Specifying a maximum recursion depth for PCRE can be done by its config, by a setting in pcre_extra, and/or by prefixing a limit into an expression. There is also a PCRE config option that simulates recursion by using allocated space vs. a program's stack. Note that many (or most?) expressions do not require a recursive process to execute, and many others need very little depth. Regards, PCRE's usage of stack space is documented in several places. Your example doesn't fail when using JIT optimization because JIT handles the stack differently. The function pcre_exec() uses an internal function match() which, by default, calls itself recursively when necessary. Each recursive call may use a few hundred bytes of a program's stack. The amount of stack needed for each recursion varies by architecture and compiler. Other factors such as a compiler's debug build option may also have a large impact. http://www.wearelondonmade.com/ The following PCRE command provides an estimate of how much stack is needed for each recursion, and will also show the config setting for the maximum allowed recursion depth (10 million?). pcretest -m -C Recent PCRE versions allow a recursion depth throttle to be specified at the beginning of an expression. With the following, PCRE will stop with an error (PCRE_ERROR_RECURSIONLIMIT = -21) when the specified recursion depth of 2500 is breached. char const *re = "(*LIMIT_RECURSION=2500)0(?:(?!foo).)+"; You can increase the sample 2500 value and at some point the fault condition will happen again, somewhere below the 10000000 config default. If you know how much stack space your program has available, and if you know about how many bytes each recursion uses, then you can estimate the depth where the exception will happen. Specifying a maximum recursion depth for PCRE can be done by its config, by a setting in pcre_extra, and/or by prefixing a limit into an expression. There is also a PCRE config option that simulates recursion by using allocated space vs. a program's stack. Note that many (or most?) expressions do not require a recursive process to execute, and many others need very little depth. Regards, PCRE's usage of stack space is documented in several places. Your example doesn't fail when using JIT optimization because JIT handles the stack differently. The function pcre_exec() uses an internal function match() which, by default, calls itself recursively when necessary. Each recursive call may use a few hundred bytes of a program's stack. The amount of stack needed for each recursion varies by architecture and compiler. Other factors such as a compiler's debug build option may also have a large impact. The following PCRE command provides an estimate of how much stack is needed for each recursion, and will also show the config setting for the maximum allowed recursion depth (10 million?). pcretest -m -C Recent PCRE versions allow a recursion depth throttle to be specified at the beginning of an expression. With the following, PCRE will stop with an error (PCRE_ERROR_RECURSIONLIMIT = -21) http://www.acpirateradio.co.uk/ when the specified recursion depth of 2500 is breached. char const *re = "(*LIMIT_RECURSION=2500)0(?:(?!foo).)+"; https://waytowhatsnext.com/ You can increase the sample 2500 value and at some point the fault condition will happen again, somewhere below the 10000000 config default. If you know how much stack space your program has available, and if you know about how many bytes https://www.webb-dev.co.uk/ each recursion uses, then you can estimate the depth where the exception will happen. Specifying a maximum recursion depth for PCRE can be done by its config, by a setting in pcre_extra, and/or by prefixing a limit into an expression. http://www.iu-bloomington.com/ There is also a PCRE config option that simulates recursion by using allocated space vs. a program's stack. Note that many (or most?) expressions do not require a recursive process to execute, and many others need very little depth. http://www-look-4.com/ Regards, -- You are receiving this mail because: You are on the CC list for the bug. -- ## List details at https://lists.exim.org/mailman/listinfo/pcre-dev