summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2004-02-11 01:15:14 +0200
committerNicholas Clark <nick@ccl4.org>2004-03-17 17:58:44 +0000
commit27d5b266d3ace9bd49a167d34f7350f3768d1326 (patch)
tree67ceee30c206b7443faf00207d8642d0c1a115a7 /pp.c
parent165cc789d248f15373a01b5b620e86cdc98e3eab (diff)
downloadperl-27d5b266d3ace9bd49a167d34f7350f3768d1326.tar.gz
malloc wrappage
Message-Id: <37BF70DE-5C0E-11D8-B5A1-00039362CB92@iki.fi> plus change croak to Perl_croak_nocontext to make ithread safe plus make it conditional on PERL_MALLOC_WRAP (default for blead is on) p4raw-id: //depot/perl@22517
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 18d4eab2d3..8b485fda1f 100644
--- a/pp.c
+++ b/pp.c
@@ -1390,8 +1390,12 @@ PP(pp_repeat)
dMARK;
I32 items = SP - MARK;
I32 max;
+ static const char list_extend[] = "panic: list extend";
max = items * count;
+ MEM_WRAP_CHECK_1(max, SV*, list_extend);
+ if (items > 0 && max > 0 && (max < items || max < count))
+ Perl_croak(aTHX_ list_extend);
MEXTEND(MARK, max);
if (count > 1) {
while (SP > MARK) {
@@ -1444,6 +1448,7 @@ PP(pp_repeat)
if (count < 1)
SvCUR_set(TARG, 0);
else {
+ MEM_WRAP_CHECK_1(count, len, "panic: string extend");
SvGROW(TARG, (count * len) + 1);
repeatcpy(SvPVX(TARG) + len, SvPVX(TARG), len, count - 1);
SvCUR(TARG) *= count;