Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: ed79937e388a8232abe29c064ca4863b6b2cc1be
      
https://github.com/Perl/perl5/commit/ed79937e388a8232abe29c064ca4863b6b2cc1be
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-01-16 (Tue, 16 Jan 2024)

  Changed paths:
    M gv.c

  Log Message:
  -----------
  Perl_amagic_call(): don't assume non-NULL PL_op

This line in Perl_amagic_call():

    U8 gimme = (force_scalar || PL_op->op_type == OP_MULTICONCAT)

relies on either PL_op always being non-null, or for the times that
PL_op is null, that force_scalar always ends up being true.

As it happens, qr// with constant overloading calls Perl_amagic_call()
with a null PL_op, but also with method=string_amg, which happens to set
force_scalar.

Add a check for PL_op being non-null, partly to future-proof the code,
but mainly to shut up Coverity, which rightly pointed out that some new
code added by me with v5.39.6-107-g547324acdb *does* check for PL_op
being non-null earlier in the function, and if there's one thing
Coverity can't abide, it's inconsistency.


Reply via email to