Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid TAR end #62

Open
kevinresol opened this issue May 13, 2017 · 0 comments
Open

Invalid TAR end #62

kevinresol opened this issue May 13, 2017 · 0 comments

Comments

@kevinresol
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant