1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
--- sv.c.orig 2005-12-05 06:45:46.000000000 -0500
+++ sv.c 2005-12-06 11:56:42.000000000 -0500
@@ -8519,7 +8519,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const cha
if (EXPECT_NUMBER(q, width)) {
if (*q == '$') {
++q;
- efix = width;
+ if (width > INT_MAX)
+ efix=INT_MAX;
+ else
+ efix = width;
} else {
goto gotwidth;
}
@@ -8707,9 +8710,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const cha
if (vectorize)
argsv = vecsv;
- else if (!args)
- argsv = (efix ? efix <= svmax : svix < svmax) ?
- svargs[efix ? efix-1 : svix++] : &PL_sv_undef;
+ else if (!args) {
+ I32 i = efix ? efix-1 : svix++;
+ argsv = (i >= 0 && i < svmax) ? svargs[i] : &PL_sv_undef;
+ }
switch (c = *q++) {
@@ -8972,6 +8976,8 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const cha
*--eptr = '0';
break;
case 2:
+ if (!uv)
+ alt = FALSE;
do {
dig = uv & 1;
*--eptr = '0' + dig;
@@ -9274,6 +9280,8 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const cha
/* calculate width before utf8_upgrade changes it */
have = esignlen + zeros + elen;
+ if (have < zeros)
+ Perl_croak_nocontext(PL_memory_wrap);
if (is_utf8 != has_utf8) {
if (is_utf8) {
@@ -9301,6 +9309,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const cha
need = (have > width ? have : width);
gap = need - have;
+#ifdef PERL_MALLOC_WRAP
+ if (need >= (((STRLEN)~0) - SvCUR(sv) - dotstrlen - 1)) {
+ Perl_croak_nocontext(PL_memory_wrap);
+ }
+#endif
SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1);
p = SvEND(sv);
if (esignlen && fill == '0') {
|