Skip to content

Commit

Permalink
Cover SEGV in utf8-c8 proc read
Browse files Browse the repository at this point in the history
Covers R#2158 rakudo/rakudo#2158
  • Loading branch information
zoffixznet committed Aug 8, 2018
1 parent 6a46d3d commit b6fc8e0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions S32-encoding/decoder.t
@@ -1,6 +1,6 @@
use Test;

plan 1;
use lib $?FILE.IO.parent(2).add: 'packages'; use Test::Util;
plan 2;


# https://github.com/rakudo/rakudo/issues/2158
Expand All @@ -16,5 +16,21 @@ plan 1;
ok $decoder.consume-all-chars().chars == $str.chars
&& $decoder.bytes-available == 0,
'utf8-c8 decoder processes all bytes of all buffers';

# cover SEGV from the same Issue
my $content := Blob[uint8].new:
60,47,116,105,116,108,101,62,60,115,99,114,105,112,116,32,
110,111,110,99,101,61,34,99,87,116,51,68,79,109,89,119,120,79,57,75,97,
121,100,83,57,112,102,80,65,61,61,34,62,40,102,117,110,99,116,105,111,
110,40,41,123,119,105,110,100,111,119,46,103,111,111,103,108,101,61,
123,107,69,73,58,39,110,69,57,113,87,56,105,122,66,101,95,77,53,103,
76,106,108,97,68,81,68,103,39,44,107,69,88,80,73,58,39,48,44,49,51,
53,51,55,52,54,44,53,56,44,49,57,53,55,44,49,48,49,56;

my $temp-file := make-temp-file :$content;
my $prog := $*DISTRO.is-win ?? 'type' !! 'cat';
#?rakudo skip 'SEGV R#2158'
ok (run $prog, $temp-file, :enc<utf8-c8>, :out).out.slurp.chars,
'no SEGV when using utf8-c8 in Proc';
}
# vim: ft=perl6 expandtab sw=4

0 comments on commit b6fc8e0

Please sign in to comment.