This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix up EXTEND() callers
authorDavid Mitchell <davem@iabyn.com>
Mon, 21 Sep 2015 13:49:22 +0000 (14:49 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 2 Oct 2015 10:29:35 +0000 (11:29 +0100)
commit052a7c766b9640ee847979cb9d2351a63e23a378
tree1a796b916aa4702854196a5c6ef9767b4d6b98e8
parent6768377c79109b7124f0c8a4e3677982689d9f49
fix up EXTEND() callers

The previous commit made it clear that the N argument to EXTEND()
is supposed to be signed, in particular SSize_t, and now typically
triggers compiler warnings where this isn't the case.

This commit fixes the various places in core that passed the wrong sort of
N to EXTEND(). The fixes are in three broad categories.

First, where sensible, I've changed the relevant var to be SSize_t.

Second, where its expected that N could never be large enough to wrap,
I've just added an assert and a cast.

Finally, I've added extra code to detect whether the cast could
wrap/truncate, and if so set N to -1, which will trigger a panic in
stack_grow().

This also fixes
    [perl #125937] 'x' operator on list causes segfault with possible
    stack corruption
doop.c
ext/B/B.pm
ext/B/B.xs
ext/XS-APItest/APItest.xs
lib/ExtUtils/typemap
mg.c
pp.c
pp_sys.c