This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert(PL_parser)
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 7 Feb 2016 00:50:33 +0000 (19:50 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 7 Feb 2016 13:23:46 +0000 (08:23 -0500)
Coverity CID 135144: Dereference after null check (FORWARD_NULL)

Earlier, pp.c:8254-ish, PL_parser is tested against NULL, so it
presumably can be NULL.

op.c

diff --git a/op.c b/op.c
index 8a8eebb..400726c 100644 (file)
--- a/op.c
+++ b/op.c
@@ -8393,6 +8393,7 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
                : NULL;
 
     if (block) {
                : NULL;
 
     if (block) {
+       assert(PL_parser);
        /* This makes sub {}; work as expected.  */
        if (block->op_type == OP_STUB) {
            const line_t l = PL_parser->copline;
        /* This makes sub {}; work as expected.  */
        if (block->op_type == OP_STUB) {
            const line_t l = PL_parser->copline;