mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
IReader.MoveToNextEntry() not terminating #83
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @eklann on GitHub (Feb 9, 2016).
I have encountered an issue with reading corrupt rar-files. When reading the entries in the file, the method IReader.MoveToNextEntry does not terminate, and the programs hangs. The program still consumes a lot of CPU, so it is doing something. I have tried to wait, but after 20 hours nothing has happened.
The following code can reproduce the issue:
I am using Sharpcompress 0.11.4 from nuget.org
I also have a file that can be used to reproduce the problem, but I am not sure where to send it? It is approximately 100MB
@adamhathcock commented on GitHub (Feb 9, 2016):
If the RAR is corrupt, then I can't do anything about it. SharpCompress doesn't do anything to detect corrupt entries. It tries to extract and I guess the decompress is confused and looping.
@eklann commented on GitHub (Feb 9, 2016):
I understand that I cannot expect the extraction to work. But I do expect it to terminate, for example by throwing an exception.
@adamhathcock commented on GitHub (Feb 9, 2016):
If it's looping in the decompression, how do you propose detecting it? It's not just a matter of throwing an exception "if something bad happens." The problem is knowing if something bad happens. There is nothing that detects loops like this.
If you want, you can see if WinRAR itself detects it and perhaps suggest checksums or something is done but then again, you don't have a checksum if you can't decompress it.
@eklann commented on GitHub (Feb 9, 2016):
I don't know about the inner workings of rar decompression, so I don't have a solution to this issue. I am posting it since I believe it to be a problem.
WinRAR gives me a Diagnostic message when opening the file, saying "Unexpected end of archive", and after that I can extract one file from the rar. The test program I provided lists the same file as WinRAR, but hangs after that.
@adamhathcock commented on GitHub (Feb 9, 2016):
It might be an issue where I need to try to count the bytes read or there's a loop in header expectation. It all depends on the type of corrupted file. It's just not nothing I've worked on: making all corrupt scenarios work. For better or worse, I've just been concentrating on the happy path scenarios.
@eklann commented on GitHub (Feb 9, 2016):
Would you like me to send you the file that can trigger this issue? If so, how?
@adamhathcock commented on GitHub (Feb 9, 2016):
Sorry, I don't think I'm going to have any time soon to go down this rabbit hole. I'm really not inclined to for corrupt RARs.
You could get the source and debug it yourself though.
@eklann commented on GitHub (Feb 10, 2016):
When do you think that this fix will be released on nuget.org?
@adamhathcock commented on GitHub (Feb 14, 2016):
Put it there now.