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

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

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
September 6, 2019 08:55
Subject:
Re: [perl #134409] Perl intepreter exception on expressionsubstitution
Message ID:
20190906085507.GP2245@iabyn.com
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/GDSearchSQLite.pm 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;
        Devel::Peek::Dump($v);
        Devel::Peek::Dump($1);
        Devel::Peek::Dump($lookup->{$1});
    }

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

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