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

7z sfx overaly detection #2088

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mehrabiworkmail
Copy link

To detect 7z SFX files, libarchive currently searches for the 7z header in a hard-coded addr range of the PE/ELF file
(specified via macros SFX_MIN_ADDR and SFX_MAX_ADDR). This causes it to miss SFX files that may stray outside these values (libarchive fails to extract 7z SFX ELF files created by recent versions of 7z tool because of this issue). This patch fixes the issue by finding a more robust starting point for the 7z header search: overlay in PE or the .data section in ELF. This patch also adds 3 new test cases for 7z SFX to libarchive.

Fixes #2075

if (__archive_read_seek(a, e_shoff, SEEK_SET) < 0) {
break;
}
h = __archive_read_ahead(a, e_shnum * e_shentsize, NULL);

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'int' before it is converted to 'size_t'.
if (__archive_read_seek(a, e_shoff, SEEK_SET) < 0) {
break;
}
h = __archive_read_ahead(a, e_shnum * e_shentsize, NULL);

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'int' before it is converted to 'size_t'.
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.

7z: failed SFX extraction due to sfx_min_addr and sfx_max_addr
1 participant