Re: [pcre-dev] [Bug 843] PCRE library segfaults on random in…

Top Page
Delete this message
Author: Sheri
Date:  
To: pcre-dev
Subject: Re: [pcre-dev] [Bug 843] PCRE library segfaults on random input
Philip Hazel wrote:
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>
> http://bugs.exim.org/show_bug.cgi?id=843
>
>
>
>
> --- Comment #3 from Philip Hazel <ph10@???> 2009-04-22 10:07:48 ---
> On Tue, 21 Apr 2009, Mark wrote:
>
>
>> I hope the small test program is helpful for you.
>>
>
> When I try your test program, the output I get is:
>
> error:regcomp:unknown error code
> Segmentation fault
>
> The segfault is not surprising - if the compile fails, you can't expect
> the exec to work. Your program ploughs on, even after a compile error,
> when the value of regexp will not be valid.
>
> Now, there obviously is some problem there, because "unknown error code"
> is not right. Testing your pattern with pcretest, I get
>
> "Pp\,-`],6QdE=%(bbjg8=g5DZao4D8^fM'I/>#Pw]XSjiFI@(?+a2l#t*1(HDA"
> Failed: digit expected after (?+ at offset 51
>
> This should end up with a BADPAT error from regcomp. Looking at the
> code, I see that there is an error in the tables that handle compile
> errors. I'll fix it for the next release, but I don't see it as hugely
> urgent.
>
> But now the question remains: why is there no "error:regcomp:..."
> message in the output you posted?
>
> Regards,
> Philip
>
>
>

I'm not a programmer but just for grins I compiled and ran it under
Windows MSVC and regcomp returned zero. That didn't happen with a
pattern where the error was a missing parentheses. The documentation
says "the yield of regcomp() is zero on success, and non-zero
otherwise," so there would seem to be an issue here, unless the above
was a trick question.

Regards,
Sheri