develooper Front page | perl.perl5.porters | Postings from February 2015

[perl #123821] OP_RV2CV can have OPpLVREF_CV

From:
Hugo van der Sanden
Date:
February 14, 2015 00:22
Subject:
[perl #123821] OP_RV2CV can have OPpLVREF_CV
Message ID:
rt-4.0.18-29049-1423873358-27.123821-75-0@perl.org
# New Ticket Created by  Hugo van der Sanden 
# Please include the string:  [perl #123821]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123821 >


AFL (<http://lcamtuf.coredump.cx/afl/>) finds:

% ./miniperl -e '\(&$0)=0'
Can't modify reference to subroutine dereference in list assignment at -e line 1, at EOF
Execution of -e aborted due to compilation errors.
miniperl: op.c:721: Perl_op_free: Assertion `!(o->op_private & ~PL_op_private_valid[type])' failed.
Aborted (core dumped)
% 

The offending op is OP_RV2CV with op_private = 0x30. This is set (unusually a direct set, not an or - that might be an additional bug) in S_lvref:
        o->op_private = OPpLVREF_CV;

The same flag is mentioned for OP_RV2CV in Perl_ck_refassign (this time it is ored in), but regen/op_private mentions it only for op types 'refassign', 'lvref'.

I'm not sure what all this stuff means; if it should legitimately get set on RV2CV, some rearrangement may be needed - it looks like OPpMAY_RETURN_CONSTANT can safely be moved to a different bit value.

Hugo




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