diff --git a/native/jni/magiskboot/format.cpp b/native/jni/magiskboot/format.cpp index 23c441d64..9c5f56a11 100644 --- a/native/jni/magiskboot/format.cpp +++ b/native/jni/magiskboot/format.cpp @@ -31,7 +31,7 @@ format_t check_fmt(const void *buf, size_t len) { return ELF32; } else if (MATCH(ELF64_MAGIC)) { return ELF64; - } else if (MATCH(GZIP_MAGIC)) { + } else if (MATCH(GZIP1_MAGIC) || MATCH(GZIP2_MAGIC)) { return GZIP; } else if (MATCH(LZOP_MAGIC)) { return LZOP; @@ -42,7 +42,7 @@ format_t check_fmt(const void *buf, size_t len) { return LZMA; } else if (MATCH(BZIP_MAGIC)) { return BZIP2; - } else if (MATCH(LZ4_MAGIC)) { + } else if (MATCH(LZ41_MAGIC) || MATCH(LZ42_MAGIC)) { return LZ4; } else if (MATCH(LZ4_LEG_MAGIC)) { return LZ4_LEGACY; diff --git a/native/jni/magiskboot/format.h b/native/jni/magiskboot/format.h index dba133ff8..b84c4173d 100644 --- a/native/jni/magiskboot/format.h +++ b/native/jni/magiskboot/format.h @@ -31,12 +31,14 @@ typedef enum { #define CHROMEOS_MAGIC "CHROMEOS" #define ELF32_MAGIC "\x7f""ELF\x01" #define ELF64_MAGIC "\x7f""ELF\x02" -#define GZIP_MAGIC "\x1f\x8b\x08" -#define LZOP_MAGIC "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a" -#define XZ_MAGIC "\xfd""7zXZ\x00" +#define GZIP1_MAGIC "\x1f\x8b" +#define GZIP2_MAGIC "\x1f\x9e" +#define LZOP_MAGIC "\x89""LZO" +#define XZ_MAGIC "\xfd""7zXZ" #define BZIP_MAGIC "BZh" -#define LZ4_MAGIC "\x04\x22\x4d\x18" #define LZ4_LEG_MAGIC "\x02\x21\x4c\x18" +#define LZ41_MAGIC "\x03\x21\x4c\x18" +#define LZ42_MAGIC "\x04\x22\x4d\x18" #define MTK_MAGIC "\x88\x16\x88\x58" #define DTB_MAGIC "\xd0\x0d\xfe\xed" #define LG_BUMP_MAGIC "\x41\xa9\xe4\x67\x74\x4d\x1d\x1b\xa4\x29\xf2\xec\xea\x65\x52\x79"