adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.26k stars 479 forks source link

Error: "Index was outside the bounds of the array." #216

Open fahmiandhika opened 7 years ago

fahmiandhika commented 7 years ago

Hi Guys,

I Have an error "Index was outside the bounds of the array." when to try extract file. below the code

` using (Stream stream = System.IO.File.OpenRead(pathForZip)) using (var reader = ReaderFactory.Open(stream)) { while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) {
Console.WriteLine(reader.Entry.Key); reader.WriteEntryToDirectory(pathForExtracting, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); }

                }
            }`

Please advice, Thanks

adamhathcock commented 7 years ago

Need a stack trace and possibly a sample file

fahmiandhika commented 7 years ago

here is the stack trace:

at SharpCompress.Compressors.Rar.Unpack20.CopyString20(Int32 Length, Int32 Distance) at SharpCompress.Compressors.Rar.Unpack20.unpack20(Boolean solid) at SharpCompress.Compressors.Rar.Unpack.doUnpack() at SharpCompress.Compressors.Rar.RarStream.Read(Byte[] buffer, Int32 offset, Int32 count) at SharpCompress.Common.EntryStream.Read(Byte[] buffer, Int32 offset, Int32 count) at SharpCompress.Common.EntryStream.SkipEntry() at SharpCompress.Common.EntryStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.Stream.Dispose() at SharpCompress.Readers.AbstractReader2.Write(Stream writeStream) at SharpCompress.Readers.AbstractReader2.WriteEntryTo(Stream writableStream) at SharpCompress.Readers.IReaderExtensions.WriteEntryToFile(IReader reader, String destinationFileName, ExtractionOptions options) at SharpCompress.Readers.IReaderExtensions.WriteEntryToDirectory(IReader reader, String destinationDirectory, ExtractionOptions options) at ebudget.Controllers.UploadADKController.d__5.MoveNext() in D:\ebudget\EBudgeting\ebudget\ebudget\Controllers\UploadADKController.cs:line 149

fahmiandhika commented 7 years ago

sorry, I can't upload the sample u ask system said : "We don't support that file type", besides my file extensions is ZIP

adamhathcock commented 7 years ago

Are you sure it's a zip? Try using ZipReader.Open or even ZipArchive.Open and see what happens.

fahmiandhika commented 7 years ago

I Don't know. the file was generated by fox pro application.And the extension is .s17. but, when I renamed the extension to zip, and try to extract it by windows (used winrar), it was success.

adamhathcock commented 7 years ago

I really have no idea what file type that is. The archive detection seems to think it is a RAR file but I couldn't tell you why.

I'm going to have to say I'm not going to support this scenario unless you can give me more information. I know nothing about Fox Pro.

fahmiandhika commented 7 years ago

FYI,

Not all of files failed to extract. Only some files (2 of 10)

and the failed file only extract some part (4048 kb from 7100kb)

fahmiandhika commented 7 years ago

hello, I still find this issue. in exception, it said : _COMPlusExceptionCode = -532462766

I have searching that code in google, but not found .

Thanks

adamhathcock commented 7 years ago

Need something more as there's no COM in this library. Stack trace?

fahmiandhika commented 7 years ago

https://drive.google.com/file/d/0B3ZUDPG-OCyNRHExRTI3ckpKWk0/view?usp=sharing

that is the sample file cannot extract.

Anyway, is there any Dependency with my hardware? or some thing must be set? I have only 4GB RAM.

adamhathcock commented 7 years ago

I've tried this file. It seems to think it's a RAR file. But maybe it's not. I have no idea what this is.

th3w1zard1 commented 1 year ago

Same problem here. I've had to fallback to 7z.dll in cases where this could happen. Here's another archive with the problem: https://deadlystream.com/files/file/585-coruscant-jedi-temple-by-deathdisco/

Strangely, 7zip doesn't output any errors or any problems at all.

adamhathcock commented 1 year ago

Looking at this file, slowly