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

Re: [perl #128255] Assert fail in S_sublex_done without othersymptoms

Thread Previous
From:
Dave Mitchell
Date:
July 8, 2016 08:56
Subject:
Re: [perl #128255] Assert fail in S_sublex_done without othersymptoms
Message ID:
20160708085627.GT17054@iabyn.com
On Thu, May 26, 2016 at 05:45:05PM -0700, Dan Collins wrote:
> dcollins@nightshade64:~/perldebug$ ./perl -Ilib  /usr/local/perl-afl/out/allcrash/f1i000029
> Use of comma-less variable list is deprecated at /usr/local/perl-afl/out/allcrash/f1i000029 line 3.
> perl: toke.c:2450: S_sublex_done: Assertion `(PL_parser->lex_inwhat) == OP_SUBST || (PL_parser->lex_inwhat) == OP_TRANS' failed.
> Aborted
> 
> dcollins@nightshade64:~/perldebug$ cat /usr/local/perl-afl/out/allcrash/f1i000029
> format=
> @

Fixed by the below:

    commit 59a08c763def19a317f229e4a95b1cdf6db8e12d
    Author:     David Mitchell <davem@iabyn.com>
    AuthorDate: Fri Jul 8 09:48:04 2016 +0100
    Commit:     David Mitchell <davem@iabyn.com>
    CommitDate: Fri Jul 8 09:48:04 2016 +0100

    RT #128255: Assert fail in S_sublex_done
    
    Some code that handles deprecated behaviour in formats was triggering
    an assertion. This:
    
        format STDOUT =
        @
        0"$x"
    
    gave this warning:
    
        Use of comma-less variable list is deprecated
    
    but then gave this panic:
    
        toke.c:2457: S_sublex_done: Assertion `(PL_parser->lex_inwhat) ==
         OP_SUBST || (PL_parser->lex_inwhat) == OP_TRANS' failed.
    
    This is due to the lexer calling scan_str(), then backing off and doing
    the warning and returning a comma, then on the next token get, calling
    scan_str() again. Because scan_str() has been called twice, the
    second time it extracts the string to PL_sublex_info.repl rather than
    PL_lex_stuff, as it does with things like s/foo/bar/ and tr/abc/ABC/.
    Later an assert that PL_sublex_info.repl is only set for a s/// or tr///
    fails.
    
    The solution seems to be to check and return a comma *before*
    trying to call scan_str().


-- 
I before E. Except when it isn't.

Thread Previous


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