Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

storing non-sv pointers in mg_obj causes crashes

1 view
Skip to first unread message

Marc Lehmann

unread,
Oct 9, 2006, 7:25:51 PM10/9/06
to Joshua N Pritikin, perl...@perl.org
Hi!

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 *.

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).

Joshua: in case you lack the time for a fix, my offer to maintain Event still
stands (and I woudl certainly give the fix more thought then :), but I
happily see that you seem to be quite active in the last months *g*.

PS: thanks for wrapping everything into typemap.c instead of sprinkling it
randomly around :)

--
The choice of a
-----==- _GNU_
----==-- _ generation Marc Lehmann
---==---(_)__ __ ____ __ p...@goof.com
--==---/ / _ \/ // /\ \/ / http://schmorp.de/
-=====/_/_//_/\_,_/ /_/\_\ XX11-RIPE

Joshua N Pritikin

unread,
Oct 10, 2006, 6:04:35 AM10/10/06
to Marc Lehmann, perl...@perl.org
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

0 new messages