Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 24542
Status: stalled
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: mwelinder [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] PerlTK encGlue.c memory corruption
Date: Wed, 24 Jan 2007 10:37:27 -0500 (EST)
To: bug-Tk [...] rt.cpan.org
From: mwelinder [...] gmail.com (Morten Welinder)
there is a systematic problem in Tk-804.027's encGlue.c that is causing memory corruption. See for example http://www.arcknowledge.com/gmane.comp.lang.perl.tk/2006-07/msg00001.html The problem is that "dSP" is declared early and that the stack can relocate between the declaration and the use of the stack. This can happen, for example, when a call to GetSystemEncoding ends up calling the perl level. One solution is to sprinkle a few SPAGAIN calls around as in the patch below. I hope I got them all. This bug also causes numerous test failures on, for example, Solaris 2.8 with Perl 5.8.8. Morten --- /home/welinder/encGlue.c Wed Jan 24 09:28:48 2007 +++ /usr/local/src/perl/mods-5.8.8/Tk-804.027/encGlue.c Wed Jan 24 09:31:10 2007 @@ -723,6 +723,7 @@ { sv_setpvn(stmp,s,len); } + SPAGAIN; PUSHMARK(sp); XPUSHs(PerlEncObj(encoding)); XPUSHs(stmp); @@ -830,6 +831,7 @@ if (srcLen) { int count; + SPAGAIN; ENTER; SAVETMPS; PUSHMARK(sp); @@ -880,6 +882,7 @@ STRLEN len; if (!encoding) encoding = GetSystemEncoding(); + SPAGAIN; ENTER; SAVETMPS; if (!src) @@ -895,6 +898,7 @@ #endif srcLen = strlen(src); } + SPAGAIN; PUSHMARK(sp); XPUSHs(PerlEncObj(encoding)); sv = newSV(srcLen);
Subject: Re: [rt.cpan.org #24542] AutoReply: [PATCH] PerlTK encGlue.c memory corruption
Date: Wed, 24 Jan 2007 10:47:25 -0500
To: bug-Tk [...] rt.cpan.org
From: "Morten Welinder" <mwelinder [...] gmail.com>
I would guess that the problem reported here is also the cause of #2842: Tk800.024 MainWindow.pm dumps the core #7989: test entry.t fails #18235: Memory corruption in Tk-804.027 Morten
I applied your patch to the SVN repository at https://svn.perl.org/modules/Tk/trunk Can you try if it really fixes the memory corruption problems? Regards, Slaven