Skip Menu |

This queue is for tickets about the Devel-Size CPAN distribution.

Report information
The Basics
Id: 1653
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Devel-Size

People
Owner: TELS [...] cpan.org
Requestors: jand [...] ActiveState.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.52
  • 0.54
  • 0.55
  • 0.56
  • 0.57
  • 0.58
  • 0.59
  • 0.60
  • 0.61
  • 0.62
  • 0.63
  • 0.64
  • 0.66
Fixed in: (no value)



Subject: All SVPV subtype may contain an RV instead of a PV
The module only checks SvTYPE(), but actually needs to check SvROK() too, to determine if the SV contains an RV or a PV. SvLEN() is irrelevant when SvROK() is set.
Date: Fri, 11 Oct 2002 13:45:31 -0400
To: bug-Devel-Size [...] rt.cpan.org, "'AdminCc of cpan Ticket #1653'": ;
From: Dan Sugalski <dan [...] sidhe.org>
Subject: Re: [cpan #1653] All SVPV subtype may contain an RV instead of a PV
At 2:28 AM -0400 10/11/02, via RT wrote: Show quoted text
>This message about Devel-Size was sent to you by JDB via rt.cpan.org > >Full context and any attached attachments can be found at: ><URL: https://rt.cpan.org/Ticket/Display.html?id=1653 > > >The module only checks SvTYPE(), but actually needs to check SvROK() >too, to determine if the SV contains an RV or a PV. SvLEN() is >irrelevant when SvROK() is set.
It should check for a valid pointer to char data first, yes. I'll go add that check in. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk
I guess this bug was resolved a long time ago. If you still have this problem, then please re-open this bug by replying to this message. Thank you for your report, Tels
Subject: RE: [rt.cpan.org #1653] All SVPV subtype may contain an RV instead of a PV
Date: Sat, 3 Mar 2007 09:49:49 -0800
To: <bug-Devel-Size [...] rt.cpan.org>
From: "Jan Dubois" <jand [...] activestate.com>
On Sat, 03 Mar 2007, via RT wrote: Show quoted text
> I guess this bug was resolved a long time ago. If you still have this > problem, then please re-open this bug by replying to this message.
Nope, the error has never been fixed. For example this block: case SVt_PV: total_size += sizeof(XPV); total_size += SvLEN(thing); break; really should read like this: case SVt_PV: total_size += sizeof(XPV); total_size += SvROK(thing) ? 0 : SvLEN(thing); break; The same change would apply to all other references to SvLEN. It does not matter that much because the core (in newSVrv()) sets SvCUR and SvLEN to 0 when it assigns a reference to any SvTYPE > SVt_RV, but XS code isn't really required to do so. Relying on SvLEN being zero when SvROK is true is similar to relying on the fact that Perl always puts a '\0' character after SvPV at index SvCUR. It is almost always true, but technically not required. Cheers, -Jan
On Sat Mar 03 12:50:19 2007, jand@ActiveState.com wrote: Show quoted text
> On Sat, 03 Mar 2007, via RT wrote:
> > I guess this bug was resolved a long time ago. If you still have this > > problem, then please re-open this bug by replying to this message.
> > Nope, the error has never been fixed. For example this block: > > case SVt_PV: > total_size += sizeof(XPV); > total_size += SvLEN(thing); > break; > > really should read like this: > > case SVt_PV: > total_size += sizeof(XPV); > total_size += SvROK(thing) ? 0 : SvLEN(thing); > break; > > The same change would apply to all other references to SvLEN.
Ok, I will apply such a change to the next release. However, since I have really no understanding of the Perl core or related things could you: * maybe send in a patch for this? * send in a testcase? * check before I release it? all the best, tels
On Tue Mar 13 13:49:02 2007, TELS wrote: Show quoted text
> On Sat Mar 03 12:50:19 2007, jand@ActiveState.com wrote:
> > On Sat, 03 Mar 2007, via RT wrote:
> > > I guess this bug was resolved a long time ago. If you still have this > > > problem, then please re-open this bug by replying to this message.
> > > > Nope, the error has never been fixed. For example this block: > > > > case SVt_PV: > > total_size += sizeof(XPV); > > total_size += SvLEN(thing); > > break; > > > > really should read like this: > > > > case SVt_PV: > > total_size += sizeof(XPV); > > total_size += SvROK(thing) ? 0 : SvLEN(thing); > > break; > > > > The same change would apply to all other references to SvLEN.
>
I applied a variant of the proposed change, and added a testcase (t/recuse.t) that tests the fix in combination with another fix. 0.67 has been uploaded to CPAN, can you please test it and tell me if it really solves the issue? All the best, Tels
Marking as resolved, if that doesn't fix your problem please re-open this bug by replying to this email. Thank you, Tels