Closed eklann closed 8 years ago
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.
I understand that I cannot expect the extraction to work. But I do expect it to terminate, for example by throwing an exception.
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.
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.
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.
Would you like me to send you the file that can trigger this issue? If so, how?
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.
When do you think that this fix will be released on nuget.org?
Put it there now.
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