Skip to content

Commit 74224d3

Browse files
committed
Fix padded PAX content handling
1 parent e15eac2 commit 74224d3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/Parser/PaxHeaderTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ protected function generateSingleFile(?int $chunkSize = null, ?int $totalSize =
3333
$data = implode("\n", [
3434
implode(' ', array_reverse([$data = 'size=' . $totalSize, strlen($data)])),
3535
]) . "\n";
36+
$dataLength = strlen($data);
37+
$data = str_pad($data, 512 * ceil($dataLength / 512), "\0");
3638

3739
yield str_pad(implode('', [
3840
/* 0 */ 'name' => str_pad('massive_file.txt', 100, "\0"),
3941
/*100*/ 'mode' => str_pad('', 8, "\0"),
4042
/*108*/ 'uid' => str_pad('', 8, "\0"),
4143
/*116*/ 'gid' => str_pad('', 8, "\0"),
42-
/*100*/ 'size' => str_pad(decoct(strlen($data)), 12, "\0"),
44+
/*100*/ 'size' => str_pad(decoct($dataLength), 12, "\0"),
4345
/*136*/ 'mtime' => str_pad('', 12, "\0"),
4446
/*148*/ 'chksum' => str_pad('', 8, "\0"),
4547
/*156*/ 'typeflag' => 'x',

0 commit comments

Comments
 (0)