develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #78980] Odd behavior when string filehandles and scalar assignment collide

From:
Father Chrysostomos via RT
Date:
January 19, 2012 23:23
Subject:
[perl #78980] Odd behavior when string filehandles and scalar assignment collide
Message ID:
rt-3.6.HEAD-14510-1327044183-489.78980-15-0@perl.org
On Sat Jan 07 05:30:12 2012, LeonT wrote:
> On Sat, Jan 7, 2012 at 3:57 AM, James E Keenan via RT
> <perlbug-followup@perl.org> wrote:
> > Confirmed. �Do you know why that null byte is overwriting the 'B'?
> 
> When $string is overwritten, the nullbyte is written but the buffer is
> kept at its existing size. :scalar ignores the new length and appends
> to the end, setting the length to what it things it should be.
> 
> Try undefining $scalar or make it an array if you want some really
> weird results. The bottom line is that :scalar makes the assumption
> that no one else will change $string, and that is not a reasonable
> assumption. I wouldn't be surprised if there was a way to make this
> segfault.

Setting the scalar to a number caused a segfault before I fixed it in
commit c5a04db879f4.

The bug in this ticket was fixed as a side-effect of fixing #92706 in
commit b65972750.  

The funny thing is that your comment came along just two days after
those fixes.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=78980



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