[pcre-dev] [Bug 990] Crash after malloc failure

Top Page

Reply to this message
Author: Philip Hazel
To: pcre-dev
Subject: [pcre-dev] [Bug 990] Crash after malloc failure
------- You are receiving this mail because: -------
You are on the CC list for the bug.


--- Comment #1 from Philip Hazel <ph10@???> 2010-05-29 16:56:53 ---
On Fri, 28 May 2010, eleventeen@??? wrote:

> In pcre_exec.c:
> #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
> {\
> heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
> frame->Xwhere = rw; \
> newframe->Xeptr = ra;\
> if newframe is NULL PCRE will crash.

This is no different from the situation when PCRE uses stack for
recursion and runs out of stack.

I suppose the reason there is no check is that it will impact on
performance, and since it will very rarely bite, is it worth it?

I will do a test by inserting


and see how much it affects the performance.

I have now done that, crudely. I measured a slow down of around 2% on
one quite complicated test.

So, what does this group think? Is this extra safety check worth a
possible 2% performance hit on matches that do a lot of recursion?


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