Revision history for Perl extension Devel::Size.
+0.74_52 2011-04-23 nicholas
+ * Fix potential SEGVs for OP_AELEMFAST on a lexical (eg $foo[3])
+
0.74_51 2011-04-22 nicholas
* Don't count PL_sv_{undef,no,yes} in the size returned
* total_size() was double-counting entries in typeglobs
TAG;break;
case OPc_SVOP: TAG;
st->total_size += sizeof(struct pmop);
- sv_size(aTHX_ st, cSVOPx(baseop)->op_sv, TRUE);
+ if (!(baseop->op_type == OP_AELEMFAST
+ && baseop->op_flags & OPf_SPECIAL)) {
+ /* not an OP_PADAV replacement */
+ sv_size(aTHX_ st, cSVOPx(baseop)->op_sv, TRUE);
+ }
TAG;break;
case OPc_PADOP: TAG;
st->total_size += sizeof(struct padop);
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 8;
+use Test::More tests => 10;
use Devel::Size ':all';
sub zwapp;
cmp_ok(length prototype $anon_proto, '>', 0, 'prototype has a length');
cmp_ok($anon_proto_size, '>', $anon_size + length prototype $anon_proto,
'prototypes add to the size');
+
+{
+ use vars '@b';
+ my $aelemfast_lex = total_size(sub {my @a; $a[0]});
+ my $aelemfast = total_size(sub {my @a; $b[0]});
+
+ cmp_ok($aelemfast_lex, '>', $anon_size,
+ 'aelemfast for a lexical is handled correctly');
+ cmp_ok($aelemfast, '>', $aelemfast_lex,
+ 'aelemfast for a package variable is larger');
+}