archive icon indicating copy to clipboard operation
archive copied to clipboard

Corrupted files extracted from PPMd ZIP archive

Open ristiisa opened this issue 2 years ago • 9 comments
trafficstars

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

ristiisa avatar Sep 11 '23 12:09 ristiisa

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

brendan-duncan avatar Sep 11 '23 21:09 brendan-duncan

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

ristiisa avatar Sep 12 '23 07:09 ristiisa

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

brendan-duncan avatar Sep 12 '23 19:09 brendan-duncan

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

brendan-duncan avatar Sep 13 '23 02:09 brendan-duncan

You can use 7zip client for that

ristiisa avatar Sep 13 '23 06:09 ristiisa

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

brendan-duncan avatar Sep 13 '23 16:09 brendan-duncan

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

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

ristiisa avatar Sep 14 '23 10:09 ristiisa

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

brendan-duncan avatar Sep 17 '23 17:09 brendan-duncan

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

brendan-duncan avatar Sep 23 '23 16:09 brendan-duncan