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

RE: [perl #134409] Perl intepreter exception on expressionsubstitution

Thread Previous | Thread Next
Chris Crook
September 7, 2019 22:18
RE: [perl #134409] Perl intepreter exception on expressionsubstitution
Message ID:

Here is the log resulting from adding the logging and exception handler.  This is still on perl 5.22.1. Also with this exception handler in place the program continued to run after hitting the panic condition and appeared to complete correctly.

In the process of trying to create a useful test case I did notice that the panic is not triggered if I turn off taint checking.

I am trying to set up a useful test that I can provide you with on perl 5.30 but taking a while.

From: Dave Mitchell via RT []
Sent: Friday, 6 September 2019 8:55 p.m.
To: Chris Crook
Subject: Re: [perl #134409] Perl intepreter exception on expression substitution

On Thu, Sep 05, 2019 at 05:04:14PM -0700, James E Keenan via RT wrote:
> > Perl raises exception on search and replace:
> >
> > panic: sv_pos_b2u: bad byte offset, blen=20, byte=27 at
> > lib/ line 81

> > 81         $v =~ s/\{(\w+)\}/$lookup->{$1}/eg;
> > I am not able to provide a useful reproducible test case.

Can you replace the substitution line with something like the following?

    eval { $v =~ s/\{(\w+)\}/$lookup->{$1}/eg; };

    if ($@) {
        require Devel::Peek;

Then if the panic is triggered, it should produce a low-level dump to
STDERR of the likely bad values.

"Procrastination grows to fill the available time"
    -- Mitchell's corollary to Parkinson's Law


This message contains information, which may be in confidence and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About