1BEGIN { 2 if ($ENV{'PERL_CORE'}) { 3 chdir 't'; 4 unshift @INC, '../lib'; 5 } 6 require Config; import Config; 7 if ($Config{'extensions'} !~ /\bEncode\b/) { 8 print "1..0 # Skip: Encode was not built\n"; 9 exit 0; 10 } 11 if (ord("A") == 193) { 12 print "1..0 # Skip: EBCDIC\n"; 13 exit 0; 14 } 15 $| = 1; 16} 17 18use strict; 19use warnings; 20 21use Test::More tests => 2; 22 23use Encode; 24 25my $str = "You" . chr(8217) . "re doomed!"; 26 27my $data; 28 29my $cb = sub { 30 $data = [ ('?') x 12_500 ]; 31 return ";"; 32}; 33 34my $octets = encode('iso-8859-1', $str, $cb); 35is $octets, "You;re doomed!", "stack was not overwritten"; 36 37$octets = encode('iso-8859-1', $str, $cb); 38is $octets, "You;re doomed!", "stack was not overwritten"; 39