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

[perl #113906] Unexpected variable assignment after restarted readline

From:
Jesse Luehrs via RT
Date:
July 1, 2012 14:03
Subject:
[perl #113906] Unexpected variable assignment after restarted readline
Message ID:
rt-3.6.HEAD-28836-1341176572-692.113906-15-0@perl.org
So I think I fixed this specific issue in the branch
doy/signal_interrupts_readline_rt113906, but this is really a specific
case of a more general (and harder to fix) problem. This specific case
is pretty easy because the only things that change when a number is
assigned to $line is that the SV is upgraded to a SVt_PVIV, the IV slot
is filled in, and some of the SV flags are adjusted, so the only thing
that needs to be done here is to readjust those SV flags.

In the case where you assign something to $line that needs to use the PV
field for something else though ($line = {}, for instance), things get
extra screwed up, because earlier in sv_gets, there is a bunch of code
that works with pointers and offsets into the string stored in the PV,
and assigning over that makes all of those variables invalid (in
particular, at sv.c:7841, bp now points to some completely unrelated
(and possibly deallocated) piece of memory).

Unfortunately, I don't really follow what's going on in that section of
the code (it is doing a lot of encapsulation-breaking peeking into
internal buffers for speed reasons), and so I don't really feel
comfortable fiddling with that part of the code. Someone who has a
better idea of how that section of code works would need to decide how
to best restructure things.

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



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