[pcre-dev] [Bug 1233] Segfault at replacement in long string

Top Page
Delete this message
Author: Petr Pisar
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1233] Segfault at replacement in long string
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1233




--- Comment #5 from Petr Pisar <ppisar@???> 2012-05-10 08:45:53 ---
It does not eliminate the problem completely. You will consume memory from heap
instead from the stack. In addition, the heap memory management is a little
slower than the stack one.

The only practical difference is the heap usage is usually unlimited in
contrast to the stack. See `ulimit -a' command output. It all depends on
setting of your user limits. Also exhausting heap leads to not-enough-memory
error, whilst exhausting stack leads to segfault.

There is yet another difference. When using stack, you can limit the depth of
recursion by PCRE API. When using heap, you can limit the amount of heap memory
by PCRE API. Both ways you can prevent from segfault, you get regular PCRE
error instead.

However calculating stack recursion from stack size limit is inaccurate. Heap
usage can be limited very precisely. So using stack you cannot never be sure
you get segfault. There were some PCRE patches to measure stack usage in bytes
instead of in stack frames, but I think they have never been merged into the
library.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email