Re: [pcre-dev] access violation in calling pcre_exec via pc…

Kezdőlap
Üzenet törlése
Szerző: Philip Hazel
Dátum:  
Címzett: Thorsten Schöning
CC: pcre-dev
Tárgy: Re: [pcre-dev] access violation in calling pcre_exec via pcrecpp::RE::TryMatch...
On Fri, 3 Dec 2010, Thorsten Schöning wrote:

> If the error occurs it always does in the following code in pcrecpp:
>
>   int options = 0;
>   if (anchor != UNANCHORED)
>     options |= PCRE_ANCHORED;
>   if (!empty_ok)
>     options |= PCRE_NOTEMPTY;

>
>   int rc = pcre_exec(re,              // The regular expression object
>                      &extra,
>                      (text.data() == NULL) ? "" : text.data(),
>                      text.size(),
>                      startpos,
>                      options,
>                      vec,
>                      vecsize);


When text.data() == NULL, is text.size() equal to zero?
What are the values of extra, startpos, vec, and vecsize?

> I think of two possibilities: There could be a bug in pcre_exec which
> results in that some code wants to write to a address which values is
> overwritten with something defined by options and is only overwritten
> if options is recognized at all, meaning not zero.


Can you run this under valgrind (or similar) to check memory accesses?

Have you tried matching the same regular expression, subject string,
options, startpos etc, using the pcretest program? If there is a bug in
pcre_exec, that *might* show it up. (Again, valgrind could be helpful.)

> Any ideas on what might be the problem? Do you think of any
> circumstances in which pcre_exec could behave like I tried to
> describe?


It does, of course, do different things when different options are set,
but without more information, I can't think of anything.

Philip

--
Philip Hazel