develooper Front page | perl.perl5.porters | Postings from September 2010

Re: Fwd: [PATCH] Re: [perl #74170] Data::Dumper -- dumping largehash returns empty string, segfaults perl

Thread Previous | Thread Next
From:
Tony Cook
Date:
September 6, 2010 16:40
Subject:
Re: Fwd: [PATCH] Re: [perl #74170] Data::Dumper -- dumping largehash returns empty string, segfaults perl
Message ID:
20100906234010.GA4955@mars.tony.develop-help.com
On Tue, Jun 15, 2010 at 07:11:43PM -0700, Father Chrysostomos wrote:
> I forgot to CC this to the list.
>
> Begin forwarded message:
>
>> From: Father Chrysostomos
>> Date: June 6, 2010 12:59:22 PM PDT
>> To: Tony Cook
>> Subject: Re: [PATCH] Re: [perl #74170] Data::Dumper -- dumping large  
>> hash returns empty string, segfaults perl
>>
>>
>> On May 31, 2010, at 6:19 AM, Tony Cook wrote:
>>
>>> On Sun, May 23, 2010 at 01:55:08PM -0700, Father Chrysostomos wrote:
>>>> 			newapad = apad;
>>>> 		
>>>> +		    diff = SP - PL_stack_sp;
>>>> 		    DD_dump(aTHX_ val, SvPVX_const(name), SvCUR(name), valstr,  
>>>> seenhv,
>>>> 			    postav, &level, indent, pad, xpad, newapad, sep, pair,
>>>> 			    freezer, toaster, purity, deepcopy, quotekeys,
>>>> 			    bless, maxdepth, sortkeys);
>>>> +		    /* DD_dump might have called a custom sort routine that
>>>> +		       might have reallocated the stack (see
>>>> +		       [perl #74170]). */
>>>> +		    SPAGAIN;
>>>> +		    SP += diff;
>>>> 		
>>>
>>> Couldn't that just be:
>>>
>>> PUTBACK;
>>> ...
>>> SPAGAIN;
>>>
>>> ?
>>
>> I have no idea. :-)
>>
>> I believe that will cause PL_stack_sp to have a different value when  
>> the custom sort sub is called, but I don’t know enough about perl’s  
>> stack to say whether that will make any difference.
>>
>> Father Chrysostomos

I applied the PUTBACK/SPAGAIN alternative as e3ec2293d and your tests
as fe642606.

Parameters supplied to a function are delimited by PUSHMARK(), which
the custom sort function call does.

If you were wondering there were two reasons I didn't want to apply
your patch:

a) it seemed over complex

b) it used an I32 offset, which could be a problem in the future with
64-bit systems.

Tony

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About