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

Closed
opened 2026-01-29 22:07:36 +00:00 by claunia · 14 comments
Owner

Originally created by @fahmiandhika on GitHub (Mar 21, 2017).

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

Originally created by @fahmiandhika on GitHub (Mar 21, 2017). 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
Author
Owner

@adamhathcock commented on GitHub (Mar 21, 2017):

Need a stack trace and possibly a sample file

@adamhathcock commented on GitHub (Mar 21, 2017): Need a stack trace and possibly a sample file
Author
Owner

@fahmiandhika commented on GitHub (Mar 21, 2017):

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 on GitHub (Mar 21, 2017): 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.AbstractReader`2.Write(Stream writeStream) at SharpCompress.Readers.AbstractReader`2.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.<UploadFile>d__5.MoveNext() in D:\ebudget\EBudgeting\ebudget\ebudget\Controllers\UploadADKController.cs:line 149
Author
Owner

@fahmiandhika commented on GitHub (Mar 21, 2017):

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

@fahmiandhika commented on GitHub (Mar 21, 2017): sorry, I can't upload the sample u ask system said : "We don't support that file type", besides my file extensions is ZIP
Author
Owner

@adamhathcock commented on GitHub (Mar 21, 2017):

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

@adamhathcock commented on GitHub (Mar 21, 2017): Are you sure it's a zip? Try using `ZipReader.Open` or even `ZipArchive.Open` and see what happens.
Author
Owner

@fahmiandhika commented on GitHub (Mar 22, 2017):

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.

@fahmiandhika commented on GitHub (Mar 22, 2017): 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.
Author
Owner

@adamhathcock commented on GitHub (Mar 22, 2017):

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.

@adamhathcock commented on GitHub (Mar 22, 2017): 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.
Author
Owner

@fahmiandhika commented on GitHub (Mar 23, 2017):

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 on GitHub (Mar 23, 2017): 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)
Author
Owner

@fahmiandhika commented on GitHub (May 22, 2017):

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

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

Thanks

@fahmiandhika commented on GitHub (May 22, 2017): hello, I still find this issue. in exception, it said : _COMPlusExceptionCode = -532462766 I have searching that code in google, but not found . Thanks
Author
Owner

@adamhathcock commented on GitHub (May 22, 2017):

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

@adamhathcock commented on GitHub (May 22, 2017): Need something more as there's no COM in this library. Stack trace?
Author
Owner

@fahmiandhika commented on GitHub (May 22, 2017):

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.

@fahmiandhika commented on GitHub (May 22, 2017): 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.
Author
Owner

@adamhathcock commented on GitHub (May 23, 2017):

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.

@adamhathcock commented on GitHub (May 23, 2017): 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.
Author
Owner

@th3w1zard1 commented on GitHub (Aug 31, 2023):

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.

@th3w1zard1 commented on GitHub (Aug 31, 2023): 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.
Author
Owner

@adamhathcock commented on GitHub (Sep 7, 2023):

Looking at this file, slowly

@adamhathcock commented on GitHub (Sep 7, 2023): Looking at this file, slowly
Author
Owner

@Nanook commented on GitHub (Feb 6, 2025):

I'll push a PR for this in a day or 2. It was raised in my app. It's getting tested on a bunch of archives from back in the day now.

@Nanook commented on GitHub (Feb 6, 2025): I'll push a PR for this in a day or 2. It was raised in my app. It's getting tested on a bunch of archives from back in the day now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#161