- if ($define{'PERL_MALLOC_WRAP'}) {
- emit_symbols [qw(
- PL_memory_wrap
- )];
- }
-
unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
skip_symbols [qw(
PL_thr_key
--- 635,640 ----
diff -rc perl-5.8.7/op.c perl-5.8.7.patched/op.c
*** perl-5.8.7/op.c Fri Apr 22 15:12:32 2005
--- perl-5.8.7.patched/op.c Mon Dec 12 18:03:35 2005
***************
*** 2076,2082 ****
/* XXX might want a ck_negate() for this */
cUNOPo->op_first->op_private &= ~OPpCONST_STRICT;
break;
- case OP_SPRINTF:
case OP_UCFIRST:
case OP_LCFIRST:
case OP_UC:
--- 2076,2081 ----
diff -rc perl-5.8.7/opcode.h perl-5.8.7.patched/opcode.h
*** perl-5.8.7/opcode.h Fri May 27 17:29:50 2005
--- perl-5.8.7.patched/opcode.h Mon Dec 12 18:03:35 2005
***************
*** 1585,1591 ****
0x0022281c, /* vec */
0x0122291c, /* index */
0x0122291c, /* rindex */
! 0x0004280f, /* sprintf */
0x00042805, /* formline */
0x0001379e, /* ord */
0x0001378e, /* chr */
--- 1585,1591 ----
0x0022281c, /* vec */
0x0122291c, /* index */
0x0122291c, /* rindex */
! 0x0004280d, /* sprintf */
0x00042805, /* formline */
0x0001379e, /* ord */
0x0001378e, /* chr */
diff -rc perl-5.8.7/opcode.pl perl-5.8.7.patched/opcode.pl
*** perl-5.8.7/opcode.pl Wed Dec 1 13:54:30 2004
--- perl-5.8.7.patched/opcode.pl Mon Dec 12 18:03:35 2005
***************
*** 606,612 ****
index index ck_index isT@ S S S?
rindex rindex ck_index isT@ S S S?
! sprintf sprintf ck_fun mfst@ S L
formline formline ck_fun ms@ S L
ord ord ck_fun ifsTu% S?
chr chr ck_fun fsTu% S?
--- 606,612 ----
index index ck_index isT@ S S S?
rindex rindex ck_index isT@ S S S?
! sprintf sprintf ck_fun mst@ S L
formline formline ck_fun ms@ S L
ord ord ck_fun ifsTu% S?
chr chr ck_fun fsTu% S?
diff -rc perl-5.8.7/patchlevel.h perl-5.8.7.patched/patchlevel.h
*** perl-5.8.7/patchlevel.h Mon May 30 22:32:42 2005
--- perl-5.8.7.patched/patchlevel.h Mon Dec 12 18:03:35 2005
***************
*** 123 ****
! ,NULL
--- 123,124 ----
! ,"SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962"
! ,NULL
diff -rc perl-5.8.7/perl.h perl-5.8.7.patched/perl.h
*** perl-5.8.7/perl.h Sat May 7 21:11:45 2005
--- perl-5.8.7.patched/perl.h Mon Dec 12 18:03:35 2005
***************
*** 3326,3335 ****
INIT("\"my\" variable %s can't be in a package");
EXTCONST char PL_no_localize_ref[]
INIT("Can't localize through a reference");
- #ifdef PERL_MALLOC_WRAP
EXTCONST char PL_memory_wrap[]
INIT("panic: memory wrap");
- #endif
if (vectorize)
argsv = vecsv;
! else if (!args) {
! if (efix) {
! const I32 i = efix-1;
! argsv = (i >= 0 && i < svmax) ? svargs[i] : &PL_sv_undef;
! } else {
! argsv = (svix >= 0 && svix < svmax)
! ? svargs[svix++] : &PL_sv_undef;
! }
! }
switch (c = *q++) {
***************
*** 8972,8977 ****
--- 8982,8989 ----
*--eptr = '0';
break;
case 2:
+ if (!uv)
+ alt = FALSE;
do {
dig = uv & 1;
*--eptr = '0' + dig;
***************
*** 9274,9279 ****
--- 9286,9293 ----
/* 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,9306 ****
--- 9315,9322 ----
need = (have > width ? have : width);
gap = need - have;
+ if (need >= (((STRLEN)~0) - SvCUR(sv) - dotstrlen - 1))
+ Perl_croak_nocontext(PL_memory_wrap);
SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1);
p = SvEND(sv);
if (esignlen && fill == '0') {
diff -rc perl-5.8.7/t/lib/warnings/sv perl-5.8.7.patched/t/lib/warnings/sv
*** perl-5.8.7/t/lib/warnings/sv Thu Mar 18 12:51:14 2004
--- perl-5.8.7.patched/t/lib/warnings/sv Mon Dec 12 18:03:42 2005
***************
*** 301,312 ****
printf F "%\x02" ;
$a = sprintf "%\x02" ;
EXPECT
- Invalid conversion in sprintf: "%z" at - line 5.
- Invalid conversion in sprintf: end of string at - line 7.
- Invalid conversion in sprintf: "%\002" at - line 9.
Invalid conversion in printf: "%z" at - line 4.
Invalid conversion in printf: end of string at - line 6.
Invalid conversion in printf: "%\002" at - line 8.
########
# sv.c
use warnings 'misc' ;
--- 301,312 ----
printf F "%\x02" ;
$a = sprintf "%\x02" ;
EXPECT
Invalid conversion in printf: "%z" at - line 4.
+ Invalid conversion in sprintf: "%z" at - line 5.
Invalid conversion in printf: end of string at - line 6.
+ Invalid conversion in sprintf: end of string at - line 7.
Invalid conversion in printf: "%\002" at - line 8.
+ Invalid conversion in sprintf: "%\002" at - line 9.
########
# sv.c
use warnings 'misc' ;
diff -rc perl-5.8.7/t/op/sprintf.t perl-5.8.7.patched/t/op/sprintf.t
*** perl-5.8.7/t/op/sprintf.t Mon Sep 1 08:41:07 2003
--- perl-5.8.7.patched/t/op/sprintf.t Mon Dec 12 18:04:18 2005
***************
*** 385,387 ****
--- 385,392 ----
>%4$K %d< >[45, 67]< >%4$K 45 INVALID<
>%d %K %d< >[23, 45]< >23 %K 45 INVALID<
>%*v*999\$d %d %d< >[11, 22, 33]< >%*v*999\$d 11 22 INVALID<
+ >%#b< >0< >0<
+ >%#o< >0< >0<
+ >%#x< >0< >0<
+ >%2918905856$v2d< >''< ><
+ >%*2918905856$v2d< >''< > UNINIT<
diff -rc perl-5.8.7/t/op/sprintf2.t perl-5.8.7.patched/t/op/sprintf2.t
*** perl-5.8.7/t/op/sprintf2.t Mon Feb 9 21:37:13 2004
--- perl-5.8.7.patched/t/op/sprintf2.t Mon Dec 12 18:08:10 2005
***************
*** 6,12 ****
require './test.pl';
}