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

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

Father Chrysostomos via RT
January 19, 2012 23:23
[perl #78980] Odd behavior when string filehandles and scalar assignment collide
Message ID:
On Sat Jan 07 05:30:12 2012, LeonT wrote:
> On Sat, Jan 7, 2012 at 3:57 AM, James E Keenan via RT
> <> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About