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

Only check RAR5 signature elsewhere on executables #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aonez
Copy link
Contributor

@aonez aonez commented Jun 2, 2024

Previously the RAR5 signature was checked in all the available "header" bytes.
This is prone to issues for example if a TAR contains some RAR5 files giving false detections and incomplete or failed extractions.

To fix this I'm just adding an executable signature check (MZ) before using all length or RAR5MaximumSFXHeader to check for the RAR5 signature.

I'm attaching some example files:

  • rar-v4.tar: contains a RAR4 file. Is detected as TAR and extracts the bare .rar file.
  • rar-v5.tar: contains a RAR5 file. Is detected as RAR5 and extracts the contents of the RAR inside the TAR.
  • parted-rar-v5.tar: contains a three parts RAR5 volume. Is detected as RAR5 and fails as tries to extract the first part found.

Did not tried but I'm assuming if the TAR file contains more files a part from the RAR5, and this one is detected, the other files will be dismissed.

Examples.zip

Previously the RAR5 signature was checked in all the available "header" bytes. This is prone to issues for example if a TAR contains some RAR5 files giving false detections and incomplete or failed extractions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant