This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix segfault on overloaded arithmetic assignment
authorDavid Golden <dagolden@cpan.org>
Fri, 9 Dec 2011 19:32:08 +0000 (14:32 -0500)
committerDavid Golden <dagolden@cpan.org>
Fri, 9 Dec 2011 19:44:42 +0000 (14:44 -0500)
commit73512201d7f34e916ab9c04a5f41248b4740e29a
treef6adbd4192d7a104fa2f4ee5fb28c9de95c8f7f4
parentb9e5552c5b9043f5218eef298d903a543fa001b5
Fix segfault on overloaded arithmetic assignment

Consider an arithmetic assignment operation of the form

  $left += $right

A segfault was occuring in the case where $right is an overloaded object
but $left is not; and where $right does not override "+=" but does
provide a 'nomethod' override.  Internally, Perl_amagic_call was
attempting to clone $left as if it were an overloaded object, causing the
segfault.  This commit fixes the segfault by only cloning the left
operand when the left operand is the overloaded one.
MANIFEST
gv.c
pod/perldelta.pod
t/lib/overload_nomethod.t [new file with mode: 0644]