Re: [pcre-dev] A test for the memory mismatch problem

Startseite
Nachricht löschen
Autor: Philip Hazel
Datum:  
To: pcre-dev
Betreff: Re: [pcre-dev] A test for the memory mismatch problem
On Thu, 29 Mar 2007, Sheri wrote:

> I compiled your pcretest.c using 7.0 headers, 7.0 pcre_tables.c and 7.1
> print*.src, then linked it against 7.0 pcre.dll.
>
> I get this lovely output.


Good, but not surprising, since we know that the 7.0 pcre.dll works.

> Also tried building 7.1 RC3 with at least malloc and free altered in
> pcre_globals.c. Saw some warnings about returning things for voids.
> Tried the pattern in pcretest (libraries and pcretest compiled and
> linked by new style configure/make) and nothing changed, still malloc
> was zero.


We really do need an expert in Windows compiling and linking here.

> =============================
> pcre_malloc set to 00402965


OK, I suppose we could check that that same value is getting passed into
pcre_compile(). If you look around line 5080 in pcre_compile.c, you will
find these lines:

----------------------------------------------------------------------
uschar cworkspace[COMPILE_WORK_SIZE];


/* Set this early so that early errors get offset 0. */

ptr = (const uschar *)pattern;
----------------------------------------------------------------------

After the first of those lines, add this one line:

fprintf(stderr, "pcre_malloc set to %p\n", (void *)pcre_malloc);

Re-compile, and run the test again. If all is well, the two lines that
say "pcre_malloc set to" should give the same value. I predict that they
won't. If I'm right, that's the problem - but WHY? If I'm wrong, it's
even more mysterious.

Philip

--
Philip Hazel, University of Cambridge Computing Service.