From 6b26b710b84110b4f96e27da59dc9c8329948e86 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 27 Apr 2014 10:23:20 +0300 Subject: [PATCH] Added simple check for unsupported compression method in .7z files --- src/resourcefiles/file_7z.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/resourcefiles/file_7z.cpp b/src/resourcefiles/file_7z.cpp index 5c92892426..a006267740 100644 --- a/src/resourcefiles/file_7z.cpp +++ b/src/resourcefiles/file_7z.cpp @@ -293,6 +293,21 @@ bool F7ZFile::Open(bool quiet) } // Resize the lump record array to its actual size NumLumps -= skipped; + + if (NumLumps > 0) + { + // Quick check for unsupported compression method + + TArray temp; + temp.Resize(Lumps[0].LumpSize); + + if (SZ_OK != Archive->Extract(Lumps[0].Position, &temp[0])) + { + if (!quiet) Printf("\n%s: unsupported 7z/LZMA file!\n", Filename); + return false; + } + } + if (!quiet) Printf(", %d lumps\n", NumLumps); // Entries in archives are sorted alphabetically