Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to check/test/repair corrupted header files #81

Open
skito opened this issue Apr 3, 2019 · 6 comments
Open

Ability to check/test/repair corrupted header files #81

skito opened this issue Apr 3, 2019 · 6 comments

Comments

@skito
Copy link

skito commented Apr 3, 2019

It will be very helpful feature!

@abbeycode
Copy link
Owner

I completely agree - I've recently come across several archives from customers with valid contents and corrupt headers. Do you know of any other libraries that do this, or what methods in the unrar API meant to do this?

@skito
Copy link
Author

skito commented Apr 16, 2019

WinRar for windows has that ability. I think the unrar API use the same libraries from RARLab, doesn't it? Also the 7zip library supports it, not sure if you can use them in ObjC/Swift, but for the same C# project I use the 7zip DLL's via 3d party product like UnrarKit called SevenZipSharp.

One interesting thing I came over while investigating the headers problem is that, the same RAR archive extracts successfully on most machines, but fails on some hardware setups with message "Corrupted headers". For a long time I was thinking that it's a download problem, but it turns out that in some cases additional .rar.crc files are needed. CRC files contains some header information about error resolving during the extraction process and are needed for some machines(guess it's matter of CPU). Here is some discussion about it

This issue with the CRC files happens mostly on multi-part archives as on my observation.

@abbeycode
Copy link
Owner

I tried opening a corrupted file in 7-Zip in Windows and didn't see any header repair options. It also failed to extract the images in the archive (they came out 0 bytes in size), whereas when I use other tools, that same archive is able to be extracted and kept mostly intact. Can you point me to some specific app actions (menu, button, etc.) or API calls that validate or fix the header?

@skito
Copy link
Author

skito commented Apr 18, 2019

Sure. Right click on the file in Windows -> 7-Zip -> Test Archive. Screenshot attached.
Screenshot_3

Also check the second menu bellow "7-Zip" where it says "CRC SHA".

@abbeycode
Copy link
Owner

Hmmm... I think all the "Test archive" option does is comparing the contents of each archived file against the CRC stored in the header. -[URKArchive checkDataIntegrity] already does that. The "CRC SHA" options generate hashes of the whole archive, so you can verify it matches the posted checksum given at the time of download. Do you know of any tools that repair the header, or can tell you if the header is corrupt rather than the archived data?

@abbeycode
Copy link
Owner

@skito have you seen the changes I've made in the v2.10 branch? I think it might possibly address what you're looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants