brendan-duncan / archive

Dart library to encode and decode various archive and compression formats, such as Zip, Tar, GZip, ZLib, and BZip2.
MIT License
399 stars 139 forks source link

Corrupted files extracted from PPMd ZIP archive #280

Open ristiisa opened 12 months ago

ristiisa commented 12 months ago

It seems that some files will get corrupted when unpacking a zip archive with PPMd compression method.

import 'package:archive/archive_io.dart';
final inputStream = InputFileStream('test.zip');
final archive = ZipDecoder().decodeBuffer(inputStream);

main() => extractArchiveToDisk(archive, 'test');

test.zip

brendan-duncan commented 12 months ago

I did just fix a bug in extractFileToDisk 3.3.9, I wonder if it would fix this issue.

ristiisa commented 12 months ago

I tried 53e1773d8e18191d6e3fea2136ba61806b7e925d and it produces similar corrupted result. Also similar results with LZMA and BZip2.

brendan-duncan commented 12 months ago

Thanks for the confirmation. I'll take a look.

brendan-duncan commented 12 months ago

Looking more closely at what your question was, I realize it's about PPMd compression. Unfortunately I don't have a PPMd decompressor.

ristiisa commented 12 months ago

You can use 7zip client for that

brendan-duncan commented 12 months ago

I mean the library doesn't have PPMd decompression code.

ristiisa commented 11 months ago

I mean the library doesn't have PPMd decompression code.

In that case perhaps the file signature should be checked to avoid corrupted data.

brendan-duncan commented 11 months ago

I'll see if I can add error checking for that.

brendan-duncan commented 11 months ago

In 3.4.2 it will throw an exception if you try to decompress an unsupported compression type, including PPMd.