[TRE-general] Weird bug
skaller
skaller at users.sourceforge.net
Tue May 16 23:50:34 EEST 2006
On Tue, 2006-05-16 at 22:23 +0300, Ville Laurikari wrote:
> On Mon, May 15, 2006 at 09:06:19PM +1000, skaller wrote:
> > Within one module yes. It's possible to link both with shared libs:
> > X links to tre and Y to gnu, A links to X and Y and passes data
> > between them without needing to link to either tre or gnu.
>
> I tried this. I made two dynamically linked libraries, X and Y. X
> compiles a regex object using regcomp() and returns it. Y runs a
> regexec() for a given compiled regex. A gives a regex object made
> with X to Y. X is explicitly linked with libtre.
>
> Both the regcomp() and regexec() calls go to TRE if A is linked with
> libtre. If A is not linked with libtre, both calls go to libc. So I
> was unable to get an inconsistent link like this.
Oh, I didn't notice before .. but these 'links' can be
inconsistent .. with the C headers.
In particular this is almost certainly what caused my
test program to segfault, with the system regex object
being bigger than the TRE one, calling gnu regcomp
then overwrote memory, since I allocated two small
a space on the stack (because I used tre header file).
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
More information about the TRE-general
mailing list