HaxeFoundation / HaxeFoundation/format

Invalid TAR end

Open
#62 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
139
Forks
65
PR merge metrics
No merged PRs in 30d

Description

```haxe
import format.tar.*;
import haxe.io.*;

using Lambda;

class Main {
static function main() {
function file(name:String, bytes:Bytes) return {
fileName: name,
fileSize: bytes.length,
fileTime: Date.now(),
fmod: 666,
uid: 1,
gid: 1,
uname: 'u',
gname: 'g',
data: bytes,
}

var data = [
file('folder/file1.txt', Bytes.alloc(4096)), // fails if: 1024, 2048, 4096, 512000, etc...
file('folder/file2.txt', Bytes.alloc(1)),
].list();

var output = new BytesOutput();
new Writer(output).write(data);
var entries = new Reader(new BytesInput(output.getBytes())).read();
for(file in entries) trace(file.fileName, file.fileSize);
}
}
```

Trying to tar some files, if the first file size is of some magic numbers, it fails to untar with `Invalid TAR end`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.