Process compressed files and analyse as much as possible (#8535)

- MAGIC_COMPRESS: If the file is compressed, unpack it and look at the
contents.
- MAGIC_CONTINUE:  Return all matches, not just the first.

Co-authored-by: Julien Voisin <jvoisin@google.com>
This commit is contained in:
Julien Voisin 2022-09-19 17:48:28 +02:00 committed by GitHub
parent 5678b99ef5
commit 44d55a37f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@
struct Environment {
Environment(std::string data_dir) {
magic = magic_open(MAGIC_NONE);
magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE);
std::string magic_path = data_dir + "/magic";
if (magic_load(magic, magic_path.c_str())) {
fprintf(stderr, "error loading magic file: %s\n", magic_error(magic));