develooper Front page | perl.perl5.porters | Postings from November 2003

Re: 5.8.2 coredump: tied hashes implemented as XSUB methods

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
November 19, 2003 04:05
Subject:
Re: 5.8.2 coredump: tied hashes implemented as XSUB methods
Message ID:
20031119100912.GA17219@fdgroup.com
On Wed, Nov 19, 2003 at 12:14:21AM +0000, Alan Burlison wrote:
> > I'm getting the SEGV in Perl_hv_clear, here:
> >
> >        I32 i;
> >        HE* entry;
> >        for (i = 0; i <= (I32) xhv->xhv_max; i++) {
> >--->         entry = ((HE**)xhv->xhv_array)[i];
> >
> >because xhv->xhv_array is NULL - I have no idea why yet.
> 
> This looks distinctly broken to me.  newHV returns a HV with xhv_array set 
> to NULL, so I can't see how the line above which indexes xhv_array without 
> checking it for NULL can ever be safe - or am I missing something?

That code is only supposed to be executed on restricted hashes, ie where
SvREADONLY is set. Presuably the assumption is that restricted hashes
always have xhv_array set. I don't know whether that assumption is valid.

Dave.

-- 
SCO - a train crash in slow motion

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