Re: storing non-sv pointers in mg_obj causes crashes

[email protected] (Joshua N Pritikin) Tue, 10 Oct 2006 15:34:35 +0530
Newsgroups perl.loop
Message-ID <[email protected]>
On Tue, Oct 10, 2006 at 01:25:51AM +0200, Marc Lehmann wrote:
> Event stores (c/typemap.c) a private pointer in mg_obj. This causes perl to
> crash (or, worse, silent memory corruption) whenever perl tries to duplicate
> the magic (e.g. when creating a thread, or forking under windows), as perl
> calls either sv_dup or sv_dup_inc on mg_obj, which in this case is not a
> valid SV *.

That's not good!

> Fixing c/typemap.c by replacing all (both) occurrences of mg_obj by the
> corretc mg_ptr fixes this problem, and seems to work (although I have not
> given this issue much testing or verification once I identified it, this
> is likely all thats required, as other uses of magic in Event seem safe).

Interesting.

I don't see a problem with mg_ptr. The test suite still passes.

I'll make the change. Let's see if anybody complains about it.

-- 
Make April 15 just another day, visit http://fairtax.org